[eluser]alex646[/eluser]
Hey guys,
Please help me with the following:
CI profiler shows two queries when only one being executed
The query code:
Code:
public function search_user_profile($first_name, $last_name, $work, $school, $place_grewup, $place_last_met, $country_of_birth) {
$this->db->select('work, school, place_grewup, place_last_met, country_of_birth');
$this->db->select('first_name, last_name');
$this->db->from('search_query');
$this->db->from('user');
$this->db->where('user.id = search_query.user_id');
if ($first_name!=''){
$this->db->like('first_name', $first_name); }
if ($last_name!=''){
$this->db->like('last_name', $last_name); }
if ($work!=''){
$this->db->like('work', $work);}
if ($school!=''){
$this->db->like('school', $school); }
if ($place_grewup!=''){
$this->db->like('place_grewup', $place_grewup); }
if ($place_last_met!=''){
$this->db->like('place_last_met', $place_last_met); }
if ($country_of_birth!=''){
$this->db->like('country_of_birth', $country_of_birth); }
$query = $this->db->get();
if($query->num_rows() >0) {
foreach($query->result() as $row)
{
$data[]=$row; //assign each row from database to $data[] array
}
return $data; //this function returns $data[] array which has all the $rows from
}
}
}
Any input is appreciated!