1064 - 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 '' at line 4

SELECT COUNT(p.products_id) as count FROM girls g INNER JOIN products p ON g.girls_id = p.products_id INNER JOIN products_to_categories p2c ON p.products_id = p2c.products_id WHERE (g.branch_id=0 OR (g.branch_id>0 and g.branch_confirm=1)) and p.products_status='1' and hidden<>'y' and girls_id <