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 'as name FROM cl_predstav WHERE idcountry in (2) and virtualcity=' at line 1 query: SELECT idd as id, as name FROM cl_predstav WHERE idcountry in (2) and virtualcity='n' ORDER BY