SELECT * FROM ls_advert WHERE ifshow=1 and stime<=1513026025 AND etime>=1513026025 AND sub=105 AND city= order by orderby 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 orderby' at line 1