I am looking for a way to search for records in my db which match/contain a certain keyword(s). Now these keyword(s) have to be its own word and not part of another word. So if the keyword is "wich", I don't want it to match records with sand"wich" in the title.
The only way I can think of doing this is by using LIKE but I can't even get that to work.
I tried using the following:
SELECT * FROM tbl_recipes WHERE title LIKE '%$term%'
but that matches all records where $term appears anywhere in the title regardless of whether its part of another word or not.
So I thought this might work
SELECT * FROM tbl_recipes WHERE title LIKE '% $term %'
but this never returns any records.
can anyone see where I'm going wrong? or if there is a better, more suitable function other than LIKE that I should use?