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 '{{837085662%' OR LOWER(description) LIKE '%/*1*/{{837085662%' OR LOWER(bri' at line 1 SQL query : SELECT COUNT(DISTINCT p.productID) FROM SS_products p where categoryID>1 and enabled=1 and ( LOWER(name) LIKE '%/*1*/{{837085662%' /* OR LOWER(product_code ) LIKE '%/*1*/{{837085662%' OR LOWER(description) LIKE '%/*1*/{{837085662%' OR LOWER(brief_description) LIKE '%/*1*/{{837085662%' */) AND ( LOWER(name) LIKE '%903135871}}%' /* OR LOWER(product_code ) LIKE '%903135871}}%' OR LOWER(description) LIKE '%903135871}}%' OR LOWER(brief_description) LIKE '%903135871}}%' */)