php - how to search result in codeigniter using age and cast -


this model have search result using mysql , codeigniter result searching fine show male not showing age , cast properly

 public function get_selected($age, $cast) {         $this->db->select('*');         $this->db->from('bride_groom_register');         $this->db->like('age', $age);         $this->db->or_like('cast', $cast);         $this->db->where("gender='male'");         $data = $this->db->get();         if ($data->num_rows() > 0) {             return $data->result_array();         } else {             return false;         }     } 

remove like , or_like use inside condition. if want provide gender give in same line.

$this->db->where("age %$age% or cast %$cast%"); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -