Hi,
I have a function that pulls rows from a database, the content->id and content->type are them used to dynamically call amethod in an already loaded model to get and format the objects details. Once the object is returned it is added to array. All is well except that when i come to use the array although it has the correct number of items in it, they all contain the same object even though i know that they are returned different. Im at a complete loss with this one, any help/ideas whould be great!
The code is below:
foreach($query->result() as $content)
{
$item = $this->{'mod_'.$content->type}->get($content->id);
print_r($item);
$items[] = $item;
}
print_r($items);
And the print_r statements produce this:
stdClass Object
(
[id] => 30
[type] => page
)
stdClass Object
(
[id] => 29
[type] => page
)
Array
(
[0] => stdClass Object
(
[id] => 29
[type] => page
)
[1] => stdClass Object
(
[id] => 29
[type] => page
)
)