Saturday, June 28, 2014

MySQL & PHP : Multiple Keyword Search

I wants to search the multiple keywords  from mysql & php.

For Ex: 

$search = "best beaches in india";

$replace_spaces = str_replace(" ","|",$search);

$sql_query = mysql_fetch_array(mysql_query("SELECT * FROM table_name WHERE table_search_field REGEXP '".$replace_spaces."'"));

print_r($sql_query);

No comments:

Post a Comment