Welcome to WebmasterWorld Guest from 184.108.40.206
$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.
You'll probably need something like this:
SELECT * FROM links WHERE ((description like '%$search_string%' OR title like '%$search_string%') AND (links.confirmed = 'yes'))
Maybe MySQL's full text search [dev.mysql.com] can help with searching for multi-word strings.