Hi all,
Iv looked at quite a lot of forums and cannot get the code to work properly for searching multiple search terms. I have tried exploding the search string and then doing a search similar to this:
WHERE fullname LIKE '%$1%' OR fullname LIKE '%$2%'
but it has not worked so I need a quick point in the right direction! Below is the code I am currently using which searches for a record that contains the whole phrase (e.g. john smith, NOT john or smith which is what I want.)
//connect to db
include('../../php/database/connect.php');
$q = $_GET['q'];
$q = strtolower($q);
$q = stripslashes($q);
$q = strip_tags($q);
$query = "SELECT * FROM products WHERE fullname LIKE '%".$q."%' ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo $row['fullname'];
}
Thanks in advance!! :)