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 sort_id' at line 1: SELECT page_id,page_name,image1 from page where image1<>0 AND parent_page_id= ORDER BY sort_id