Running this DB call will provide me with a multidimensional array. I'm attempting to retrieve each key, but it always returns as a blank page or an array.
$root_array = array();
$sites = $this->sites($member_id);
foreach ($sites as $site){
$records = $this->db->select('p.name as place_name, p.id as place_id,p.active as place_status')
->from('places p')
->join('members_permissions pm','pm.sites_id = p.sites_id and pm.members_id ='.$member_id)
->where('p.active', 0)
->get();
$places = $records->result_array();
$places['name'] = $site['name'];
foreach($places as $place){
$root_array[$site['name']][] = $place;
}
}
return $root_array;
My PHP that loops through:
<?php foreach($places as $site): ?>
<h5><?=key($site)?></h5>
<?php foreach($site as $place): ?>
<h6><?=$place['place_name']?></h6>
<?php endforeach?>
<?php endforeach ?>
Additionally, the result of a test I ran that only output the array is [Philadelphia], which is what I'm trying to render.
[Philadelphia] => Array
(
[0] => Array
(
[place_name] => XYX
[place_id] => 103200
[place_status] => 0
)
[1] => Array
(
[place_name] => YYYY
[place_id] => 232323
[place_status] => 0
)
Can someone please help me with this?