I have an array which looks like this:
Array
(
[response] => Array
(
[dataInfo] => Array
(
[totalRecordCount] => 362
[foundCount] => 5
[returnedCount] => 5
)
[data] => Array
(
[0] => Array
(
[fieldData] => Array
(
[groupAssetID] => 1020
[groupAssetName] => Standard Equipment
)
[portalData] => Array
(
)
[recordId] => 823
[modId] => 1
)
[1] => Array
(
[fieldData] => Array
(
[groupAssetID] => 1001
[groupAssetName] => Tools
)
[portalData] => Array
(
)
[recordId] => 829
[modId] => 1
)
[2] => Array
(
[fieldData] => Array
(
[groupAssetID] => 1005
[groupAssetName] => Spare Parts
)
[portalData] => Array
(
)
[recordId] => 830
[modId] => 1
)
)
)
[messages] => Array
(
[0] => Array
(
[code] => 0
[message] => OK
)
)
)
I'm trying to loop over this and extract the values for groupAssetID and groupAssetName in the data array but haven't been able to get this to work so far. I've tried:
foreach ( $records as $record) {
echo $field . ": " . $value . "<br />\r\n" ;
}
and
foreach ( $records->fieldData as $field=>$value) {
echo $field . ": " . $value . "<br />\r\n" ;
}
but none of these seem to work and I can't work out the correct syntax here.