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?
Model:
$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->car_id;
}
foreach ($bought_cars as $bought_car)
{
return $bought_car;
}
Controller
$bought_car = $this->car_model->car();
echo($bought_car);
Thank you in Advance!
CIactive recorddblibrary and$bought_carsis array so why are not returning whole array?