October 18th, 2000, 04:58 PM
Join Date: Oct 1999
Location: Annapolis, Maryland US
Time spent in forums: < 1 sec
Reputation Power: 15
1. will this pick up fields that start or end with $test?
>> should do both
2. How can I do some logical operators like AND and OR.
$searchlist=array("cat", "dog", "mouse");
$query="SELECT * from trovemain WHERE ";
$query.="cata LIKE '%$searchlist[$i]%' OR ";
$query=substr($query, 0 -3); // strip off last 'OR '
$query.=" order by some_column";
//run the query
You can make the $searchlist array an array of variables from the form.
You could also include a radio button saying "Search by ALL terms" (AND) or "Search by ANY term" (OR) - this will give you the ability to choose AND or OR for your query syntax.