Welcome Guest, Not a member yet? Register   Sign In
dynamically store data in multidimensional arrays with keys
#7

[eluser]smickiedoo[/eluser]
So it no longer throws an error but the data is still not being appended.

I tried:

Code:
$data['something'] = array('id' => 1, 'name' => 'title 1', 'more_data'=>'hello world');
foreach($query->result() as $row)
        {
          array_push(
                  
                $data['something'],  array('id'=>$row->id, 'name'=>$row->name, 'more_data'=>$row->more_data )
            );
        }

and in my view:

Code:
foreach($something as $item) { echo($item['id']); }

It outputs only:

1


Messages In This Thread
dynamically store data in multidimensional arrays with keys - by El Forum - 11-23-2008, 03:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB