tags:

views:

47

answers:

3
include("conn.php");
$result = mysql_query("SELECT * FROM sggame");

while($row = mysql_fetch_assoc($result));
{
 $id = $row['id'];
 echo $id;
 echo 'working?';
}

The above code simply doesn't return anything out of the db. The row name is correct and the loop runs, showing that there is something in the database. However the row is just not echoed out at all. This is code i have used a thousand time before and am rather perplexed as to why it has stopped now! Any help, as always, is much appreciated

+4  A: 

replace

while($row = mysql_fetch_assoc($result));

with

while($row = mysql_fetch_assoc($result))
Aron Rotteveel
Cheers man, i've been staring at that for hours!
Drew
No problem, this happens to everyone of us someday, I guess :)
Aron Rotteveel
A: 

Pretty much the same reason as your last question - pesky semicolons!

Johan
A: 

did this code give off a notice or warning when you where running it ? I am just curious being that the problem was the semicolon.

Ronald Conco
while (condition); is the same as while (condition){}, i.e. a while loop with an empty body.
Paul Dixon