PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mikusan
Forum Contributor
Posts: 247 Joined: Thu May 01, 2003 1:48 pm
Post
by mikusan » Fri Jan 23, 2004 5:53 pm
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?
dull1554
Forum Regular
Posts: 680 Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W
Post
by dull1554 » Fri Jan 23, 2004 6:02 pm
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...
mikusan
Forum Contributor
Posts: 247 Joined: Thu May 01, 2003 1:48 pm
Post
by mikusan » Fri Jan 23, 2004 7:35 pm
The thing is that it does not get there... so it doesn't matter what i echo... it just doesn't get there.
dull1554
Forum Regular
Posts: 680 Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W
Post
by dull1554 » Fri Jan 23, 2004 7:43 pm
can you show me all of your code...perhaps your problem lies earilier in the script
DuFF
Forum Contributor
Posts: 495 Joined: Tue Jun 24, 2003 7:49 pm
Location: USA
Post
by DuFF » Fri Jan 23, 2004 7:44 pm
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());
?>
dull1554
Forum Regular
Posts: 680 Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W
Post
by dull1554 » Fri Jan 23, 2004 8:02 pm
i was just figuring that there was not a positive connection.....but W/E
mikusan
Forum Contributor
Posts: 247 Joined: Thu May 01, 2003 1:48 pm
Post
by mikusan » Fri Jan 23, 2004 8:20 pm
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