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='2063' OR productID IN (22025,45370,22026,45371,22027,22028,45372,22029,45373,45374,45375,22030,22031,45376,22032,22033,45377,45378,22034,45379,22035,22036,22037,22038,22039,22040,45380,22041,22042,22043,54372,54373,45313,45314,45315,73687,73688,73689,73692,73693,73694,73695,73696,45311,)