CodeIgniter Forums
search - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: search (/showthread.php?tid=41387)



search - El Forum - 05-06-2011

[eluser]Unknown[/eluser]
hey, i'm new in codeigniter.I make a search engine.My problem is i don't want to include all of the field when I start searching.if any of these fields are missing i want to return true.but i can't do this.Please help me....

here is my code
...Controller...
public function search_data()

$data=array();
$data['Category']=$this->input->post('Category', true);
$data['Country']=$this->input->post('Country', true);
$data['Mobile']=$this->input->post('Mobile1', true);
$data['Name'] =$this->input->post('Name', true);
$data['Contact']=$this->db->show_search($data);
}

....Model...

function show_search($data){

$result = '';
$this->db->select ('*');
$this->db->from ('tb');
$this->db->where ('Category',$data['Category']);
$this->db->where ('Country',$data['Country']);
$this->db->where ('Mobile',$data['Mobile']);
$this->db->where ('Name',$data['Name']);

}