2 Votes Vote

Why doesn't this "while" loop work?

Posted by topdog 382 days ago Questions| doesn loop work work All

Why does this loop work...

while($row = mysql_fetch_assoc(mysql_query($all)));

...but this one doesn't?

while($row = mysql_fetch_assoc($sql))

Basically they are same. The first one is:

$all ="SELECT * FROM test";
mysql_query($all);

and the second one is:

$sql = mysql_query("SELECT * FROM test");

Originally asked by: rookie on Stack Overflow

Discuss Bury


Who Voted for this Question