PDA

View Full Version : SQL Syntax Error



Titan85
04-26-2007, 12:01 AM
Hello, I am having an issue with an sql query. Here is my code:
$get = mysql_query("SELECT * FROM `teams` ORDER BY name ASC LIMIT $cur, $max") or die ("Error Getting Teams! \n<br />\n" .mysql_error());When I run that I get this error:
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 1When I take out the limit section or the order by section, it works. Any reason for this. Thanks

djr33
04-26-2007, 01:18 AM
Looks fine, but that probably means that the values of the $cur or $max variables are wrong, or perhaps do not exist (hence why it says the error is an empty string).

Titan85
04-26-2007, 01:20 AM
Thanks, I guess the error was in an include that was not getting the values. Its working now :)