Wednesday, 21 August 2013

search with quotes and without quotes in php mysql

search with quotes and without quotes in php mysql

I have a string with double quotes. i.e. "this is text" when i search only
this is text no results display. I want to search both string like with
quote and without quotes. so what's the query made?
function template($val)
{
$Qry11=Database::Read("SELECT subcategory.*,C_Name,description FROM
subcategory JOIN category ON subcategory.C_id=category.C_id JOIN
product_description ON subcategory.S_id = product_description.S_id
WHERE S_Name LIKE '%$val%' OR C_Name LIKE '%$val%' group by
subcategory.S_id");
$List11 = Array();
$thisObjectName11 = get_class($this);
while($arr = Database::Reader($Qry11))
{
$data = new $thisObjectName11();
$data->temp_Id = $arr[S_id];
$data->C_Name = $arr[description];
$data->Nm = $arr[C_Name];
$data->S_Name = $arr[S_Name];
$List11[] = $data;
}
return $List11;
}

No comments:

Post a Comment