You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY i.id DESC LIMIT 0, 14' at line 1 SQL=SELECT i.*, c.name as categoryname,c.id as categoryid, c.alias as categoryalias, c.params as categoryparams FROM kba07_k2_items as i RIGHT JOIN kba07_k2_categories AS c ON c.id = i.catid WHERE i.published = 1 AND i.access IN(1,1,5) AND i.trash = 0 AND c.published = 1 AND c.access IN(1,1,5) AND c.trash = 0 AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2020-08-05 19:54:09' ) AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2020-08-05 19:54:09' ) AND c.id IN () ORDER BY i.id DESC LIMIT 0, 14