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 '"))%' OR LOWER(description) LIKE '%c0eaeaf3ecf3e' at line 1 SQL query : SELECT COUNT(DISTINCT p.productID) FROM SS_products p where categoryID>1 and enabled=1 and ( LOWER(name) LIKE '%c0eaeaf3ecf3ebfff2eef0+fly+mlp3084134*//**//**/"))%' /* OR LOWER(product_code ) LIKE '%c0eaeaf3ecf3ebfff2eef0+fly+mlp3084134*//**//**/"))%' OR LOWER(description) LIKE '%c0eaeaf3ecf3ebfff2eef0+fly+mlp3084134*//**//**/"))%' OR LOWER(brief_description) LIKE '%c0eaeaf3ecf3ebfff2eef0+fly+mlp3084134*//**//**/"))%' */) AND ( LOWER(name) LIKE '%order%' /* OR LOWER(product_code ) LIKE '%order%' OR LOWER(description) LIKE '%order%' OR LOWER(brief_description) LIKE '%order%' */) AND ( LOWER(name) LIKE '%by%' /* OR LOWER(product_code ) LIKE '%by%' OR LOWER(description) LIKE '%by%' OR LOWER(brief_description) LIKE '%by%' */) AND ( LOWER(name) LIKE '%1*/#%' /* OR LOWER(product_code ) LIKE '%1*/#%' OR LOWER(description) LIKE '%1*/#%' OR LOWER(brief_description) LIKE '%1*/#%' */)