Filtering and searching in codeigniter

前端 未结 1 1028
忘了有多久
忘了有多久 2021-02-11 09:34

I am doing a filtering and searching in codeigniter but no idea! how to do that?

but i try my best but fail!!!

here i show the list which

相关标签:
1条回答
  • 2021-02-11 09:48

    you might try like this ,Your Controller function code

    public function get_quick_search()
    {
            $s_data['sepcli'] = $this->input->post('spec');
            $s_data['distct'] = $this->input->post('dist');
            $s_data['locat']  = $this->input->post('locat');
    
    
            $data['quck_search'] = $this->search_model->get_quick_list($s_data);
            $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');
    }
    

    your model function code

    public  function get_quick_list($s_data)  
    {  
        $this->db->select('td.*, ts.*')
        $this->db->from('tbl_doctor as td');    
        $this->db->join('tbl_specialisation as ts', 'ts.spec_id = td.spec_id','left');
    
        if($s_data['sepcli'] !="")
           $this->db->like('ts.spec_specialise',$s_data['sepcli'],'both');
        if($s_data['distct'] !="")
           $this->db->like('td.district',$s_data['distct'],'both');
        if($s_data['locat'] !="")
           $this->db->like('td.place', $s_data['locat'], 'both');
    
        $query=$this->db->get()->result_array(); 
        return $query;
    }
    

    sure it will helps , you should try it !!!

    0 讨论(0)
提交回复
热议问题