phpfanphp Posted September 17, 2007 Share Posted September 17, 2007 Does anyone know why the following code keeps returning this error: 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 'ORDER BY position ASC' function get_pages_for_subject($subject_id) { global $connection; $query = "SELECT * FROM tblpages WHERE subject_id = {$subject_id} ORDER BY position ASC"; $page_set = mysql_query($query, $connection); confirm_query($page_set); //the function we made return $page_set; } Thanks! Link to comment https://forums.phpfreaks.com/topic/69624-solved-question-about-query/ Share on other sites More sharing options...
btherl Posted September 17, 2007 Share Posted September 17, 2007 Your subject_id is probably empty. That's my first guess. Link to comment https://forums.phpfreaks.com/topic/69624-solved-question-about-query/#findComment-349842 Share on other sites More sharing options...
phpfanphp Posted September 17, 2007 Author Share Posted September 17, 2007 Found it! Thanks Link to comment https://forums.phpfreaks.com/topic/69624-solved-question-about-query/#findComment-349861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.