I am trying to display only user selected pages in dashboard
I have two columns in database like this
create table users(userid varchar(50), scripts varchar(100))
in userid column
i will have the logged in user name and in scripts column
, names of the pages which they want to display it in dashboard in comma separated format. ex: total, cust_orders,...
I want to fetch page name from scripts column separately like total.php, cust_orders.php...
i tried doing like this
$sql = "select scripts from users where userid = '".$_SESSION['UserID']."' ";
$result = DB_query($sql,$db);
$myrow = DB_fetch_array($result);
foreach ($myrow as $res)
{
$array123[] = $res;
$var123 = $array123[0];
$var222 = $array123[1];
}
but it wont work as the pages can be from 1 to 8, can somebody please help me in this?
EDITED
I have done like this
$result = DB_query($sql,$db);
$myrow = DB_fetch_array($result);
$arr= $myrow['scripts'];
$arr1 = explode(',', $myrow['scripts']);
print_r ($arr1);
and it worked, it displays like this
Array ( [0] => total_dashboard [1] => customer_orders [2] => unpaid_invoice [3] => lat
but dynamically how can i separate it and i have to add .php
to this ...