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 publication_id=2 AND (((publication_start='0000-00-00' OR CURDATE()>=public' at line 1
SELECT count(*) FROM verhovina_gallery as main WHERE parent_id=0 AND languages_id= AND publication_id=2 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, gallery_ord