PC Nerd Posted February 4, 2007 Share Posted February 4, 2007 hi guys im having trouble with the following SQL, the error i receive is: Query died: 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 '=< 20 ORDER BY Rank, User_Name' at line 1 CODE $lower_page_num = $start_page * 20; $higher_page_num = ($start_page + 1) * 20; $curr_page_SQL = "SELECT User_Name, Points, Rank, Resource_1 FROM General_Stats WHERE Rank >= ".$lower_page_num." AND =< ".$higher_page_num." ORDER BY Rank, User_Name"; $curr_page_query = mysqli_query($DB_Server, $curr_page_SQL) or die("Query died: ".mysqli_error($DB_Server)); thanks for any help PC Nerd Link to comment https://forums.phpfreaks.com/topic/37023-solved-incorrect-sql/ Share on other sites More sharing options...
Tyche Posted February 4, 2007 Share Posted February 4, 2007 Use "<=" not "=<" as below $curr_page_SQL = "SELECT User_Name, Points, Rank, Resource_1 FROM General_Stats WHERE Rank >= ".$lower_page_num." AND <= ".$higher_page_num." ORDER BY Rank, User_Name"; Link to comment https://forums.phpfreaks.com/topic/37023-solved-incorrect-sql/#findComment-176740 Share on other sites More sharing options...
PC Nerd Posted February 4, 2007 Author Share Posted February 4, 2007 still the error: Query died: 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 '<= 20 ORDER BY Rank, User_Name' at line 1 thanx anywayz, anything else i should try Link to comment https://forums.phpfreaks.com/topic/37023-solved-incorrect-sql/#findComment-176743 Share on other sites More sharing options...
Tyche Posted February 4, 2007 Share Posted February 4, 2007 Add the field name before the <= $curr_page_SQL = "SELECT User_Name, Points, Rank, Resource_1 FROM General_Stats WHERE Rank >= ".$lower_page_num." AND RANK <= ".$higher_page_num." ORDER BY Rank, User_Name"; Link to comment https://forums.phpfreaks.com/topic/37023-solved-incorrect-sql/#findComment-176749 Share on other sites More sharing options...
PC Nerd Posted February 4, 2007 Author Share Posted February 4, 2007 Tyche: both of your suggestions worked, both the SQL and the html formatting one earlier, thanx so much Link to comment https://forums.phpfreaks.com/topic/37023-solved-incorrect-sql/#findComment-176756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.