My directory script does this;
Take in input in a text field, allows - (minus) to show you don't want that term included;
PHP Code:
<?
$words = explode(" ", strtolower($_GET['query']));
$sql = "";
foreach($words as $key=>$value) {
if($value{0}=='-') { $sql .= " AND product_title NOT LIKE '%".substr($value,1,strlen($value))."%'"; }
else { $sql .= " AND product_title LIKE '%$value%'"; }
}
?>
so you can tag $sql onto your query to search. Thus, a search for "tube" would match
"test-tubes"
fake test-tubes"
but a search for "tube -fake" would only match
"test-tubes"
That help at all?
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources, Please login or register to view this content. Registration is FREE
Last edited by webwoRRks; 08-11-2004 at 07:04 AM..
Reason: typo
|