title: Codeigniter pass array from Model to Controller
body: <p>Im trying to send an array of data from the model to the controller but when I echo on controller, I only see the first value no all the array of the values. Whats wrong?</p>
  
  <p>Model:</p>
  
  <pre><code>        $sql = "
          SELECT car_id
          FROM cars
          WHERE price= 1";
  
          $res = mysql_query($sql);
  
          $bought_cars= array();
          while ($row_ya = mysql_fetch_object($res)) 
          {
              $bought_cars[] = $row_ya-&gt;car_id;
          }
          foreach ($bought_cars as $bought_car) 
          {
                  return $bought_car;
          }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>$bought_car = $this-&gt;car_model-&gt;car();
  
  echo($bought_car);
  </code></pre>
  
  <p>Thank you in Advance!</p>