Long list, of nothing....

Posted on Tuesday 21st August 2007 at 04:49 PM
Diablosblizz
Diablosblizz's Avatar
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 2007 at 10:21 PM
Dean
Dean's Avatar
DO
PHP Code
  1. $query = mysql_query("SELECT * FROM `shop_cat`");
  2. while($cat = mysql_fetch_array($query)) {
  3. echo(" <a href='?page=view&id=$cat[id]'>$cat[name]</a>");
  4. }
  5. ?>
Posted on Thursday 23rd August 2007 at 09:12 AM
SkillMaster
SkillMaster's Avatar
The mysql_query cant be in the while loop
Login or register to respond to this forum topic.