vicdesigns Posted April 27, 2011 Share Posted April 27, 2011 Howdy folks, I am creating a Facebook app for a bit of fun and practice and getting the following error in index.php: Invalid query -- SELECT * FROM `results` WHERE `resultLow` <= AND `resultHigh`>= -- 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 'AND `resultHigh`>=' at line 1 Here is the area: $res = query("SELECT * FROM `results` WHERE `resultLow` <=$user_score AND `resultHigh`>=$user_score"); Any help would be appreciated. Link to comment https://forums.phpfreaks.com/topic/234820-error-in-mysql-syntax/ Share on other sites More sharing options...
Pikachu2000 Posted April 27, 2011 Share Posted April 27, 2011 It would appear that the $user_score variable is empty. Link to comment https://forums.phpfreaks.com/topic/234820-error-in-mysql-syntax/#findComment-1206737 Share on other sites More sharing options...
vicdesigns Posted April 27, 2011 Author Share Posted April 27, 2011 It would appear that the $user_score variable is empty. Thank you for you reply. I have checked the Database etc and everything is there. Link to comment https://forums.phpfreaks.com/topic/234820-error-in-mysql-syntax/#findComment-1206740 Share on other sites More sharing options...
Pikachu2000 Posted April 27, 2011 Share Posted April 27, 2011 It doesn't matter what's in the database if the variable you're using to compare it against is empty. You need to find out why it's empty and fix that problem. Link to comment https://forums.phpfreaks.com/topic/234820-error-in-mysql-syntax/#findComment-1206938 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.