i implement a search page in my site.
i use the search page to search mysql db for products.
now i can enter the name of the product and then go to
the db and search for this product by name.
the problem is :
suppose that i have a product that its name is "Linux".
then if i write in the search box "Linux" then the query
return that product.
but what about if i write in the search box "Linu" OR "Lin"
now the query don't return any thing.
as my code is:
Code: Select all
$name = $HTTP_POST_VARS["product_name"];
$res = mysql_query("select * from products where productName like '$name' ");
$rows = mysql_num_rows($res);
if($rows != 0)
{
print "PRODUCT HAS FOUND";
}
else
{
print "PRODUCT HAS NOT FOUND";
}the product "Linux" although i may enter "Lin" or any
similar string
Thanks in advance