Hey guys, I'm having a little problem. I'm using this code but its only showing me 1 of the rows in the database. I would want all of the data to be listed. Not sure why its only one. If I set ORDER BY ASD, it shows 1 piece of data from the last row of the table. What am I doing wrong? Thanks,
Your only fetching data from the query once. You need to loop through it to fetch the rows until you have gotten them all. $result = mysql_query("SELECT * FROM tournaments WHERE approved='0'"); while ($row = mysql_fetch_array($result)) echo "<br />".$row['name']."<br />"; PHP:
Recommend putting braces after while loop to avoid complications with repeating unwanted lines or not repeating all lines.
just noticed that a little optimization is possible in query. If approved is a integer column, do not wrap the input with quotes. (Remove quotes around ZERO '0' => 0) SELECT * FROM tournaments WHERE approved=0 What happens otherwise is all the entries in that column will get converted in string type and then compared with '0' which is slower process than integer to integer comparison, though this wont make any difference for small tables but its always good to keep things optimized at early stage itself