I'm building a customizable menu on my website. Customizable because you can change the order of the itens. For that, i create a colum 'barra' on my users MySQL's table, and I save thing like this: 02,05,04,09,01, where each number is a menu item (like: 02 is Movies, so the first item is Movies). To get the code saved on the table, just afeter the login code, I'm using:
PHP Code:
$n_query="SELECT barra FROM users WHERE username='$username'";
$bar_t = mysql_query($n_query) or die ("Wasn't possible to contact the server.");
To split the values into different vars and save in the section. However, when I ran the code, I get 'Resource id #4' on my pages. I searched the internet and a saw that I have to use something like this:
PHP Code:
$bar = mysql_fetch_array($bar_t)
first, but when I do it, it returns 'Array'. Could someone, please, help me with this? My site is http://dragaodiario.6te.net/ (on Portuguese).
So you're only getting one row because a username is unique.
Use this:
PHP Code:
$n_query="SELECT barra FROM users WHERE username='$username'"; $bar_t = mysql_result(mysql_query($n_query),0,0) or die ("Wasn't possible to contact the server.");
Bookmarks