Reputation: 5
So I'm trying to use the LIKE %...%
what I have so far is this
SELECT * FROM stores WHERE 'name' LIKE '%$searchTerm%' AND price > 0
Unfortunately this returns the entire table instead of the specific term that is being searched. I also checked the value of the $searchTerm
variable and it's working as intended.
Upvotes: 0
Views: 54
Reputation: 416
do not provide single quotes around your column name : if name is your column_name then try this:
SELECT * FROM stores WHERE name LIKE '%".$searchTerm."%' AND price > 0
Upvotes: 4