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='4268' OR productID IN (47604,47605,47606,47607,47608,47609,47610,47611,47612,47613,47614,47615,47616,47617,47618,47619,47620,54851,54852,54853,54854,54855,47635,47636,47637,47638,47639,47640,47641,47642,47643,47644,47645,47646,47647,54856,47648,47649,47650,47651,47652,47653,47654,47655,47656,47657,47658,47659,47660,47661,47662,47663,47664,47665,47666,54857,47667,54858,47668,47669,47670,47671,54859,54860,47672,47673,47674,47675,47676,47677,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,)