我在代码点火器中进行多次搜索,列表显示三个选择框 专业化,区域,成功全部列出的地方
为MyModel
public function get_quick_list($locat,$distct,$sepcli)
{
$this->db->select('*');
$this->db->from('tbl_doctor');
$this->db->join("tbl_specialisation", "tbl_specialisation.spec_id = tbl_doctor.spec_id",'left');
$this->db->where("(district LIKE '$distct' AND place LIKE '$locat' AND spec_specialise LIKE '$sepcli')");
$query=$this->db->get()->result_array();
var_dump($query);die();
return $query;
}
我的控制器
public function get_quick_search()
{
$sepcli= $this->input->post('spec');
$distct= $this->input->post('dist');
$locat= $this->input->post('locat');
$data['list'] = $this->Doctor_model->search_listing();
$data['quck_search'] = $this->search_model->get_quick_list($sepcli,$distct,$locat);
$data['get_specs'] = $this->specialisation_model->get_specialisation();
$this->load->helper(array('form', 'url'));
$this->load->view('customer/header');
$this->load->view('customer/side_view',$data);
$this->load->view('customer/quick_search',$data);
$this->load->view('customer/footer');
}
返回查询显示空值
答案 0 :(得分:0)
在您的模型中,您的代码应为
public function get_quick_list($locat,$distct,$sepcli)
{
$this->db->select('*');
$this->db->from('tbl_doctor');
$this->db->join("tbl_specialisation", "tbl_specialisation.spec_id = tbl_doctor.spec_id",'left');
$this->db->where("(district LIKE '%".$distct."%' AND place LIKE '%".$locat."%' AND spec_specialise LIKE '%".$sepcli."%')");
$query=$this->db->get()->result_array();
var_dump($query);die();
return $query;
}
让我们解释%通配符在SQL LIKE条件下的工作原理。 请记住,%通配符匹配任何长度的任何字符串 (包括零长度)。