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='2062' OR productID IN (22006,45360,22007,45361,22008,22009,45362,22010,45363,45364,39776,22011,22012,45365,22013,22014,45366,45367,22015,45368,22016,22017,22018,22019,22020,22021,45369,22022,22023,22024,54370,54371,45313,45314,45315,73687,73688,73689,73692,73693,73694,73695,73696,45311,)