php sql search query help?

Daniel Smith

New member
Hi

I am creating a search function on a website that I am making and am having trouble getting the search to be a little more flexible. if in my content I had the keyword "red" and a user searches "red car" I would like it to find this but as it stands it don't, am I using the correct wild cards or what could I do to improve my query?

$sql = "SELECT * FROM content WHERE content LIKE N'%$query%' ORDER BY popularity DESC";
Yes I have a field name and table name that are the same at the moment didn't realise when I created the table in PhpMyAdmin.
 
Back
Top