1064 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 '))' at line 9
in:
[select count(distinct p.products_id) as total FROM (products p, products_description pd, categories c, products_to_categories p2c ) WHERE (p.products_status = 1
AND p.products_id = pd.products_id
AND pd.language_id = 1
AND p.products_id = p2c.products_id
AND p2c.categories_id = c.categories_id AND (( pd.products_name LIKE '%lovely%'
OR p.products_model
LIKE '%lovely%' ) and ( pd.products_name LIKE '%quinceanera%'
OR p.products_model
LIKE '%quinceanera%' ) and ))]