Example keyword search "CAR WASH"
a car wash should appear in a line regardless of position
The search string can be very long, and the query must search for these keywords together and separately. There may be more than two keywords.
$query="SELECT * FROM TABLE WHERE zip LIKE'abc'"; $key= explode(" ", $keywords); for($i = 0; $i < count($key); $i++){ $query.=" AND (dealTitle LIKE '".$key[$i]." %' OR dealTitle LIKE '% ".$key[$i]." %' OR dealTitle LIKE '% ".$key[$i]." ')"; }
However, the query returns those records containing βcarβ or βwashβ.
If I use the βcar washβ, both words should appear at least once. Any suggestion on how to change my search to accept this condition?
source share