Error: SELECT count(company_id) FROM company_city_cat WHERE city_id = AND cat_id = 2827 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 'AND cat_id = 2827' at line 1