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 languages_id=1 AND publication_id=5 AND (((publication_start='0000-00-00' O' at line 1
SELECT count(*) FROM merstan_catalog_categories as main WHERE catalog_id= AND languages_id=1 AND publication_id=5 AND (((publication_start='0000-00-00' OR CURDATE()>=publication_start) AND (publication_end='0000-00-00' OR CURDATE()<=publication_end)) OR (users_id_author=0 AND users_id_author<>0) OR 1=2) AND current_flag=1 ORDER BY pwrord desc, catalog_categories_ord