Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 586
0 Users 6 Guests Online
Forum Index » PHP + MySQL » Long list, of nothing....
Posted on Tuesday 21st August 2007 at 04:49 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
Code
while ($cat = mysql_fetch_array(mysql_query("SELECT * FROM `shop_cat`"))) {
echo "<a href='?page=view&id=$cat[id]'>$cat[name]</a>";
}


This, should display the categories names. But... it does not. It just shows a big list of nothing! What did I do wrong?
Posted on Wednesday 22nd August 200 at 10:21 PM
Dean
templates/default/images/noavatar.png's Avatar
Active Member
DO
PHP Code
1
2
3
4
5
6
$query = mysql_query("SELECT * FROM `shop_cat`");
while($cat = mysql_fetch_array($query)) {
echo(" <a href='?page=view&id=$cat[id]'>$cat[name]</a>");
}
?>
Posted on Thursday 23rd August 2007 at 09:12 AM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
The mysql_query cant be in the while loop