This is my query:
SELECT product_id, product_view, product_main_cat, product_sub_cat, product_title, product_description, LEFT(product_description, 100) As prod_desc_trimmed, product_price, product_sale_price, product_photo_thumb, product_photo_big
FROM product_products
WHERE product_view = 'S' AND product_main_cat = colname OR product_view = 'S' AND product_sub_cat = searchsubcat
ORDER BY product_title ASC
When I access the page with this query with this url:
http://www.mydomain.com/products/products.php?product_id=2&searchmaincat=1&searchsubcat=
I get this error:
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 'ORDER BY product_title ASC' at line 1
The page works ok when directly viewed, but when viewed from the above url with variables, it spits out the error.
Any idea what could cause this??
Thanks
Peter