I'm trying to query two values from database, with 2 different IDs and I need to get all the results on one array. This is part of my controller.
function account()
{
$user_id = $this->session->userdata('user_id');
$this->load->model("Site_model");
$q = $this->Site_model->get_all_notify($user_id);
}
and here is the Model:
function get_user_data_by_id($id) {
$this->db->where("id",$id);
$q=$this->db->get("users");
return $q->result();
}
function get_all_notify($user_id) {
$this->db->where("wanted_id",$user_id);
$this->db->where("requests_id",1);
$q=$this->db->get("intrested");
foreach($q->result() as $row) {
$user=$this->get_user_data_by_id($row->users_id);
}
return $user;
}
But when I print_r $q from controller I only get 1 row... but when I print_r $user I get all the results! Even with foreach nothing seems to work!