What I wanna do is make it possible to search for partial content in
model,variant, and type fields, all 3 at the same time, or each individually
as the user wants...case insentive too ...

<? //assuming you got a POST from the form :) reset ($_POST); while (list ($key, $val) = each ($_POST)) { $$key = $val; }

if(!(empty($model))) {
        $searchstring .= " AND model LIKE '$model'";
}
if(!(empty($variant))) {
        $searchstring .= " AND variant LIKE '$variant'";
}
if(!(empty($fields))) {
        $searchstring .= " AND fields LIKE '$fields'";
}

$query = "SELECT * FROM cpu WHERE cpuID <> '0' $searchstring ORDER BY cpuID";
$connection = mysql_connect($HOST, $USERNAME, $PASSWORD);
$SelectedDB = mysql_select_db($DBNAME);
$result = mysql_query($query);


//etc.
?>

It's a bit quick and dirty, because you need something like the cpuID <> '0' to make this to work. But its a start right ;)


laters,


Fedde

~= The sum of the intelligence on the planet is a constant; the population is growing. =~

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to