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='4253' OR productID IN (46336,46337,46346,46347,46348,46349,46350,46351,46352,46353,46354,46359,46360,46361,46362,46367,46368,46369,54380,54381,54382,66421,66422,66423,66424,66428,66429,66430,66434,46334,46335,)