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 ') And i.id NOT IN(41610) ORDER BY i.id DESC LIMIT 0, 5' at line 1 SQL=SELECT i.id, i.title,i.alias,i.introtext, c.alias as catalias,c.id as catid FROM news_k2_items as i LEFT JOIN news_k2_categories c ON c.id = i.catid WHERE i.published = 1 and ( i.metakey like"%Begum Jaan Movie Review%" OR i.metakey like"% Begum Jaan Movie Rating%" OR i.metakey like"%Begum Jaan Movie%" OR i.metakey like"%Begum Jaan Talk%" OR i.metakey like"%Begum Jaan Collections%" OR i.metakey like"%Begum Jaan Hindi Movie Rating%" OR i.metakey like"% Begum Jaan Hindi Movie Review%" OR) And i.id NOT IN(41610) ORDER BY i.id DESC LIMIT 0, 5