here is my way ...
PHP Code:
if($keyword){
// remove the space from the beginning //
$keyword = ltrim($keyword);
// also from the end //
$keyword = rtrim($keyword);
}
if($keyword != "" And substr_count("$keyword"," ") >=1){ // More than 1 word
$By_Like = " And MATCH (title,des) AGAINST ('$keyword')";
$Match_Word =1;
//echo "many";
}
elseif($keyword != "" And substr_count("$keyword"," ") < 1){ // then just 1 word
$By_Like = " And( title like '%$keyword%' OR des like '%$keyword%') ";
$Match_Word =0;
//echo " 1 word ";
}
///
$query= mysql_query("select * from house where
active='yes' And
country ='$Country'
$By_City
$By_Cat And
($s_type) $By_Like
");
///
if($By_Like And $Match_Word=0){
$des = ereg_replace("$keyword","<font color=#FF0000>$keyword</font>",$des);
}
elseif($By_Like And $Match_Word=1){
$This_des = explode(' ', $keyword);
foreach ($This_des as $xdes){
if($xdes !=""){
$des = ereg_replace("$xdes","<font color=#FF0000>$xdes</font>",$des);
}
}
}
and it`s work as need ..
Bookmarks