Hallo I need some help on spotting a bug or another solution in the following mysql query: i have table recipecat and columns - id, group, name... $result = mysql_query("SELECT * FROM recipecat WHERE group='Menuideas' ORDER BY name") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo "<A href='menuideas.php?cat=$row[name]'>$row[name]</a><br>"; } PHP: getting following error from the browser: My php/mysql version is phpMyAdmin 2.7.0-pl1 MySQL 4.0.24 I have been using similar query before with no problems, there must be something wrong i do, well it is. i cant spot it. Thanks a lot for your advice Nita
group is reserved word in mysql so you have to write: $result = mysql_query("SELECT * FROM recipecat WHERE `group`='Menuideas' ORDER BY name") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo "<A href='menuideas.php?cat=$row[name]'>$row[name]</a><br>"; } PHP: with `group` instead of simple group
yes if you use erserve words of mysql then it will show error.but many time we dont know what are those reserved words so it is better to put ' ' before and afer every name;it will make the work safe.