Ok Im trying to create a search results page for my web site and I just cannot figure it out. My code at the moment is like this:
$query = "SELECT * FROM links WHERE ((description OR title like '%$search_string%') AND (links.confirmed = 'yes')) $limit"; $result = mysql_query($query);
Trouble is it returns some results that are nothing like the search string and also fails to return some results that are like the search string. I have tried variations of the above and still cannot get it to do what I want. I just want the script to search two columns and return all results that match and that are like the search string regardless of case sensitivity. I have been playing around with this for a few days now and I am stuck.
Can anyone help me or point me in the right direction. Does anyone know of any good sites that provide good tutorials? Not just basic tutorials but a good in depth one on a site search?
Also the above code will only return matches on the entire phrase right? How do I get it to search for a through each search word if there are multiple words? I think it is by using the explode function in php right? ANyway I would just like to get the above working and then I can start on matching phrases, any words, all words etc.