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 '1778582393'')as/**/int)%' OR LOWER(description) LIKE '%78/**/and/**/cast(md5(' at line 1 SQL query : SELECT COUNT(DISTINCT p.productID) FROM SS_products p where categoryID>1 and enabled=1 and ( LOWER(name) LIKE '%nokia%' /* OR LOWER(product_code ) LIKE '%nokia%' OR LOWER(description) LIKE '%nokia%' OR LOWER(brief_description) LIKE '%nokia%' */) AND ( LOWER(name) LIKE '%n%' /* OR LOWER(product_code ) LIKE '%n%' OR LOWER(description) LIKE '%n%' OR LOWER(brief_description) LIKE '%n%' */) AND ( LOWER(name) LIKE '%78/**/and/**/cast(md5(''1778582393'')as/**/int)%' /* OR LOWER(product_code ) LIKE '%78/**/and/**/cast(md5(''1778582393'')as/**/int)%' OR LOWER(description) LIKE '%78/**/and/**/cast(md5(''1778582393'')as/**/int)%' OR LOWER(brief_description) LIKE '%78/**/and/**/cast(md5(''1778582393'')as/**/int)%' */)