PDA

View Full Version : Query Question



Titan85
04-20-2007, 12:32 AM
Ok, I am trying to query my database and limit the results, here is the query I am using:
mysql_query("SELECT * FROM `teams` WHERE approved = 'yes' ORDER BY name ASC LIMIT $cur, $maxTeams") or die ("Error Getting Teams! \n<br />\n" .mysql_error()); I can find nothing wrong with this, but it keeps throwing this error at me:

Error Getting Teams!
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 '' at line 1The near " at line one isn't really helpful at all. I am getting frustrated because it just doesn't seem like there is anything that can be wrong. I would greatly appreciate it if someone could send an idea my way. Thanks

thetestingsite
04-20-2007, 01:21 AM
You may want to make sure that the variables $cur and $maxTeams are getting a value assigned to them. Probably the best way to do this is by echoing them after they are supposed to be assigned.

Hope this helps.

mburt
04-20-2007, 10:44 AM
Or, you might want to try:

mysql_query("SELECT * FROM `teams` WHERE approved = 'yes' ORDER BY name ASC LIMIT ".$cur.", ".$maxTeams) or die ("Error Getting Teams! \n<br />\n" .mysql_error());