Welcome Guest, Not a member yet? Register   Sign In
[solved] array modication during a foreach loop
#2

[eluser]xwero[/eluser]
try this

Code:
///Get List of Events
$eventlist = $this->EventModel->get_parent_events();

///Loop through events retrieved
$i = 0;
foreach($eventlist as $item):

$eventid = $item['eventid'];
///Get the number of attendees from MYSQL
$event_attendance = $this->EventModel->count_parent_attendence($eventid);
///Append the open array with the count
$eventlist[$i]['count'] = $event_attendance['count'];  
++$i;                  

endforeach;

print_r($eventlist);


Messages In This Thread
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 02:43 PM
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 03:16 PM
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 03:43 PM
[solved] array modication during a foreach loop - by El Forum - 03-01-2008, 03:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB