PHP / MySQL : help with a search function?

  • Thread starter Thread starter steve_456
  • Start date Start date
S

steve_456

Guest
hey i'm making a search function for finding products on my website. At the minute it finds exact matches of what is typed in the searchbox, but i want to find products which contain what is searched for.

So for example if i typed "big" in the searchbox, then "really big product" would appear in the list. I have tried using the '%' character, all my attempts so far haven't worked.

Here's my code i have at the minute which finds exact matches...

if(isset($_POST['search']))
{
$search = $_POST['search'];
$result = $db->execute
("SELECT * FROM product WHERE descriptor = '$search' ");
}

Any help much appreciated :)
 
Back
Top