Hi,
I'm using the code below to do a boolean search (i got it from this great forum) anyway: the problem is when i enter 2 words seperated with a space... without the boolean words (and, or, not)
Because then it makes the select as:
"select from $table where $method like %search1% like %search2%"
This doesn't work offcourse...
How can i get around this problem?
if (!$method) {
$method = "keywords";
}
$arrSearch = explode(" ", $searchstring);
for ($i=0; $i<count($arrSearch); $i++) {
if (strToUpper($arrSearch[$i])=='AND' or strToUpper($arrSearch[$i])=='OR' or strToUpper($arrSearch[$i])=='NOT') {
if (strToUpper($arrSearch[$i])=='NOT') {
$i++;
$strWhere = $strWhere." and " . $method ." not like '%".$arrSearch[$i]."%'";
} else {
$strWhere = $strWhere." ".$arrSearch[$i]." ";
}
} else {
$strWhere = $strWhere." " . $method ." like '%".$arrSearch[$i]."%'";
}