PHP Search Query
Posted: Wed May 16, 2012 6:36 am
Hi All.
I am looking to search a database of products based upon someone typing the name of the product they are looking for.
I am using the below SQL request:
Unfortunately this only shows what ever your typing and anything before or after (%) is there any way that it could also search unplaced string instances?
For example
$q = "SELECT * FROM products WHERE prod_name LIKE '%$id%' order by fee asc LIMIT 20";
If i type black ops ps3 it brings back search result until i get to the PS3 part. because entries in the db are "black ops for the PS3" because i havent conformed it says no results.
I need it to show all results.
is there another way? or can someone point me in the right direction?
I am looking to search a database of products based upon someone typing the name of the product they are looking for.
I am using the below SQL request:
Unfortunately this only shows what ever your typing and anything before or after (%) is there any way that it could also search unplaced string instances?
For example
$q = "SELECT * FROM products WHERE prod_name LIKE '%$id%' order by fee asc LIMIT 20";
If i type black ops ps3 it brings back search result until i get to the PS3 part. because entries in the db are "black ops for the PS3" because i havent conformed it says no results.
I need it to show all results.
is there another way? or can someone point me in the right direction?