I have an MVC structure set up in codeigniter in PHP. However, for some reason, my model results do not like being foreached over, giving me; `Invalid argument supplied for foreach()`. Here is the rough code of my model:

```
class some_model extends CI_Model
{
    function __construct()
    {
        // Call the Model constructor
        $this->load->database();
    }

    function some_func()
    {
       //Prepare return
       $return = array();

       //Do query
       $query = $this->db->query('SELECT tbl.* from tbl');

       //Get array of values
       $result = $query->result_array();

       foreach($result as $row)
       {
           $return[] = array(

               'a'                    => $row['a'],
               'b'                    => $row['b'],
               'c'                    => $row['c']
           );
       }

    return $return;
}

```

And the controller:

```
$this->load->model('some_model');
$stuff = $this->some_model->some_func();

foreach($stuff as $row)
{
   //Do something
}

```

But I always get an error at the foreach loop in the controller. Does anyone have an idea as to why this might be happening? I have checked, and PHP does see `$stuff` as an array (`is_array($stuff)` returns true), so I have no idea what might be happening. I do know that the foreach loop in the model is not the problem, as it does not give me any errors, only the one in the controller does. Any tips would be appreciated. Thanks beforehand!