Okay i have a small SQL problem maybe you can see where im going wrong here:
Okay i have a database called CustomerDirectory, which has a table called Products which in turn has a coloumn called product_cat. Now if i want to sort the list of products and only display products that have a specific value in the product_cat section. How do i go about it?
Heres what i have so far, as an SQL statement its pretty easy:
SELECT * FROM products WHERE product_cat = "books"
simple and it works. 🙂
What i cant do is get it to display the same results when in php. So whats the equivalent of that in php?? What im working on at the moment is a SELECT and WHERE query, which looks like:
//Select statement
$query = "SELECT products " .
"FROM products" .
"WHERE product_cat = books";
But that doesnt seem to work instead is throws the 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 '= books' at line 1"
So obviously my php equivalent isnt correct. Can anyone tell me why, and what am i doing wrong??