You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 SQL query : select count(*) from SS_discussions_new WHERE categoryID='2059' OR productID IN (45313,45314,45315,73687,73688,73689,73692,73693,73694,73695,73696,45311,)