Possible Duplicate:
Order of LIKE clause in query when wanting to use multiple terms
I am attempting to make a search function on my website. I want to search more than one field.
for example:
$sql=mysql_query("select * from inventory WHERE MATCH (pn, description, location, notes) AGAINST ('{$q}') ORDER BY {$sort} {$direction}") or die(mysql_error());
The above searches pn, description, location, and notes. But it only searches for exact matches. So I'm wanting to use:
$sql=mysql_query("select * from inventory where pn like '%{$q}%'") or die(mysql_error());
But search more than one field like the above. How can I go about doing this?