zend like mysql problem
- by pradeep
hi,
I am trying to use like in zend
switch($filter2)
{
case 'name':
switch($filter1)
{
case 'start_with':
$search = "\"pd_name like ?\", '$patient_search_name%'";
break;
case 'contains':
$search = "'pd_name like ?', '%$patient_search_name%'";
break;
case 'exact_match':
$search = "'pd_name = ?', $patient_search_name";
break;
}
break;
case 'phone':
switch($filter1)
{
case 'start_with':
$search = "'pd_phone like ?', '$patient_search_name%'";
break;
case 'contains':
$search = "'pd_phone like ?', '%$patient_search_name%'";
break;
case 'exact_match':
$search = "'pd_phone = ?', $patient_search_name";
break;
}
break;
}
$select = $this->getDbTable()->select()
->from("patient_data",
array('*'))
->where("$search");
but when i see the query log its like
SELECT `patient_data`.* FROM `patient_data` WHERE ("pd_name like ?", 'bhas%')
where as the ? should have been replaced by the value ....how to solve this??