I have a table say 3 fields in MySQL. I need to search for a string using PHP My code is like
<?PHP
//SET THE SEARCH TERM
$term = "Search Term";
//QUERY THE TITLE AND CONTENT COLUMN OF THE PAGES TABLE RANK IT BY THE SCORE
$sql = "SELECT *, MATCH(title, content) AGAINST('". $term ."') as score FROM pages WHERE MATCH (title, content) AGAINST('". $term ."') ORDER BY score DESC";
$query = mysql_query($sql);
//BUILD A LIST OF THE RESULTS
while($result = mysql_fetch_assoc($query)) {
echo("{$result['title']} - {$result['score']}");
}
?>
Here it searched for the single word which is exactly in the database. I need to search for multiple words..How can I change the above code. Can someone suggest some idea.