I have a form with one input where people can type in search terms. It then takes them to a script where it assigns a value to the search term and then runs it against a mysql product database. The problem is I would like to break the users search query into individual words for better search results. I have tried using explode() and it wont work. I have no idea why, this is the select statement I am using now including all the fields which need to be searched. Can you see any problems with it, maybe the problem isnt with the explode function but with my statement? If not, is there a simple alternative way to doing a search against a mysql db and breaking up a query into individual keywords? Thank you for the help.
Code:
$rs = mysql_query("SELECT * FROM inventory WHERE condition = 'used' AND make LIKE '%" . $keywords . "%' OR type LIKE '%" . $keywords . "%' OR item_number LIKE '%" . $keywords . "%' OR year LIKE '%" . $keywords . "%' OR size LIKE '%" . $keywords . "%' OR finish LIKE '%" . $keywords . "%' OR model LIKE '%" . $keywords . "%' OR serial_number LIKE '%" . $keywords . "%' OR price LIKE '%" . $keywords . "%' OR information LIKE '%" . $keywords . "%' OR description LIKE '%" . $keywords . "%'");
|