Is there another way to write this array looping code. I seem to get a server 500 error when I run the code which I cant seem to understand. It specifically occurs on the the array_push line. Any help guidance on rewriting the statement without using the array_push would help me.
$PaymentOrderItems = array();
foreach($resultBookings->getRecords() as $key=>$record_row) {
$Item = array(
'name' => $record_row->getField('Start_date'),
'desc' => $record_row->getField('Description'),
'amt' => $record_row->getField('Price_per_week'),
);
array_push($PaymentOrderItems, $Item); //this line is the culprit - if I comment this this out
}
Many Thanks
The code appears fine. I'm assuming you've already verify the validity of the result collection?
If not, then it sounds like it may be results related. Is the data structure being returned as you're expecting?