I have a database with a table called 'customers', which has the fields firstname, lastname, homephone, workphone, and emailaddress. I need to be able to search this field. $searchterm is the input the enduser has put into the search bar. So currently, I have it set up as such...
Code: Select all
$splitsearch = explode(" " $searchterm);
$termcount = count($splitsearch);
$i=0
while($i<$termcount)
{
$query = "SELECT firstname, lastname, homephone, workphone, emailaddress, FROM customers, WHERE firstname LIKE '%$splitsearch[$i]%' || lastname LIKE '%$splitsearch[$i]%' || homephone LIKE '%$splitsearch[$i]%' || workphone LIKE '%$splitsearch[$i]%' || emailaddress LIKE '%$splitsearch[$i]%'";
$i++;
}
$result = mysql_query($query);Can anyone help please? This is quite important, and I would be most grateful. Thanks!!