I am constructing an array like this:
$result = $this->db->get($this->_table);
foreach ($result->result_array() as $row)
{
$list->$row['categories_id'] = array('total_amount' => $row['total_amount'], 'other_stuff' => 'stuff');
}
This gives me a fatal exception "Cannot access empty property"
<?foreach ($category_list as $index => $row) {?>
<td><?=$row?></td>
<td><?=$list->$index['total_amount']?></td>
<?}?>
but this works
<?foreach ($category_list as $index => $row) {?>
<td><?=$row?></td>
<? $temp = $list->$index; ?>
<td><?=$temp['total_amount']?></td>
<?}?>
Is there a better way to get the "total amount" from this object?
Even better - how can I make it so the object performs like this
echo $list->$index->total_amount