Page 1 of 1

query problem

Posted: Wed Jul 30, 2008 7:30 am
by itsmani1
My query is working fine but i want refine this query, for example some pass a string like: silver's, gold's etc then how it will work? it don't work problem for characters like '," etc

Code: Select all

select product.productid from product where product.product_title like '%".$_GET["srchStr"]."%'
any one can help?

Re: query problem

Posted: Wed Jul 30, 2008 8:04 am
by ody3307
I find it simpler to do this:
$query = "'%";
$query .= $_GET["srchStr"];
$query .= "%'"
(wrap the search string first)
Then...
"select product.productid from product where product.product_title like $query"
(the $query variable includes the single quotes needed)