2016-12-01 4 views
1

私はフィルタリングと検索を行っていますが、アイデアはありません!どうやって? しかし、私はベストを尽くすが失敗する!ここ 私はコードイグナイタのフィルタリングと検索

enter image description here MYデータベースを成功事例のアヤックス によってショーがあるリストにリストをすべて表示する enter image description here enter image description here MYコントローラである

public function get_quick_search() 
 
{ 
 
     $sepcli= $this->input->post('spec'); 
 
     \t $distct= $this->input->post('dist'); 
 
     \t $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'); 
 
}

MY MODEL LIKE

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(); 
 

 
    
 
      return $query; 
 
}
HERE

NO ERRORを示すが、RETURNクエリは次のようにNULL SHOW IS(配列(0){})

+0

問題はどこですか? –

+0

モデルが表示されています –

+0

私はクエリの再実行null値を –

答えて

3

あなたはこのようにしてみてくださいかもしれない、あなたのコントローラー機能コード

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'); 
} 

あなたのモデルの機能コード

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; 
} 

確かにそれは試してみてください!

+0

私は試してみます –

+0

大丈夫です。このフォームのデータは次のようになります。ant-ghosh –

+0

私のリストデータこのタイプ