我想通过两个参数search_id和电子邮件
进行搜索控制器
function search_patients()
{
$data['query']=$this->UserModel->search_patients($this->input->post('search'));
$this->load->view('search_patients_view',$data);
}
模型
function search_patients($search)
{
return $query = $this->db->get_where('patient', array('patient_id'=> $search))->result();
}
答案 0 :(得分:1)
你应该绑定你喜欢的地方
$where = '(patient_id ="' . $search . '" or email = "' . $search . '")';
$this->db->select('*');
$this->db->from('patient');
$this->db->where($where);
$query = $this->db->get();
$result = $query->result_array(); // this will return you array
return $result;