title: returning array from Model to Controller codeigniter
body: <p>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.</p>
  
  <pre><code>function account()
  {
      $user_id = $this-&gt;session-&gt;userdata('user_id');
      $this-&gt;load-&gt;model("Site_model");
      $q = $this-&gt;Site_model-&gt;get_all_notify($user_id);
  }
  </code></pre>
  
  <p>and here is the Model:</p>
  
  <pre><code>function get_user_data_by_id($id) {
      $this-&gt;db-&gt;where("id",$id);
      $q=$this-&gt;db-&gt;get("users");
      return  $q-&gt;result();
  }
  
  function get_all_notify($user_id) {
      $this-&gt;db-&gt;where("wanted_id",$user_id);
      $this-&gt;db-&gt;where("requests_id",1);
      $q=$this-&gt;db-&gt;get("intrested");
      foreach($q-&gt;result() as $row) {
          $user=$this-&gt;get_user_data_by_id($row-&gt;users_id);
      }
      return $user;
  }
  </code></pre>
  
  <p>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!</p>