syntax error

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

Post Reply
Faithe
Forum Commoner
Posts: 33
Joined: Tue Jul 12, 2005 3:26 pm
Location: WA

syntax error

Post by Faithe »

Well, after searching around the forums a bit, I found nothing that successfully solved the problem, so hopefully posting about it will do the trick :] It seems simple enough, but I can't figure out why it won't work.

Code: Select all

$query = mysql_query("SELECT * FROM bmem WHERE bmid =". $_SESSION['id']. "ORDER BY Rand() LIMIT 15");
That's the line the error message specifies, saying "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY Rand() LIMIT 15' at line 1"

It'd be great if someone could point out what i'm doing wrong :]

Thanks.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Put a space between ORDER and the quote.
There are 10 types of people in this world, those who understand binary and those who don't
Faithe
Forum Commoner
Posts: 33
Joined: Tue Jul 12, 2005 3:26 pm
Location: WA

Post by Faithe »

;] thanks.
Post Reply