1
我想在Zend中一樣使用Zend公司,如MySQL問題
開關($過濾器2) { 情況下, '名稱': 開關($過濾器1) { 案 'start_with': $搜索= 「\」pd_name like?\「,'$ patient_search_name%'」; 休息;
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");
,但是當我看到查詢記錄其像
SELECT `patient_data`.* FROM `patient_data` WHERE ("pd_name like ?", 'bhas%')
,其中作爲?應該已經被替換的值....如何解決這個問題?
哦okie我得到it..now我所寫的Zend是對待像一個單一的變量.....我做了一個解決方法,並寫爲 $ search =「pd_name like'%$ patient_search_name%'」 它的工作....希望其適當... – Hacker 2010-05-05 09:47:06