Page 1 of 1
Easy while loop question
Posted: Fri Jan 23, 2004 5:53 pm
by mikusan
Hi, this is probably real dumb...
but here i go anyways...
Code: Select all
$SQL = mysql_query("SELECT anything FROM sometable ORDER BY uid DESC LIMIT 10");
while( $Data = mysql_fetch_assoc($SQL) ) {
echo('Why wont you work');
}
The echo does not display.... Ironically i used this peice of code before an it worked... am i doing something stupid here or is it somewhere else?
Posted: Fri Jan 23, 2004 6:02 pm
by dull1554
heres what you have to do
say you want to echo "something from "sometable", you would do this
echo $Data['something'];
that should do the trick...
Posted: Fri Jan 23, 2004 7:35 pm
by mikusan
The thing is that it does not get there... so it doesn't matter what i echo... it just doesn't get there.
Posted: Fri Jan 23, 2004 7:43 pm
by dull1554
can you show me all of your code...perhaps your problem lies earilier in the script
Posted: Fri Jan 23, 2004 7:44 pm
by DuFF
Are you sure the query is working? Try using this line to see if the query is working or not:
Code: Select all
<?php
$SQL = mysql_query("SELECT anything FROM sometable ORDER BY uid DESC LIMIT 10") or die(mysql_error());
?>
Posted: Fri Jan 23, 2004 8:02 pm
by dull1554
i was just figuring that there was not a positive connection.....but W/E
Posted: Fri Jan 23, 2004 8:20 pm
by mikusan
That was really dumb... thank you very much DuFF
I added that error and i knew exactly what was wrong... DOH... i wish my server had error set to E_all
Bah... thanks