[eluser]gscharlemann[/eluser]
The array formatting code is fantastic...a huge help. But after following the example here, I'm still having issues in my view. I am getting an undefined variable error.
I'm attempting to pass $query->result_array() to my view with the following data.
In the controller:
Code:
$people_array = $query->result_array();
$this->load->view('people',$people_array);
The data in the array is as follows:
Code:
$msg_name not passedArray
(
[0] => Array
(
[contact_number] => 1
[first_name] => John
[last_name] => Doe
)
[1] => Array
(
[contact_number] => 2
[first_name] => Jane
[last_name] => Doe
)
)
In the view, I've attempted the following:
Code:
<?php
foreach($people_array as $people)
{
foreach($people as $person)
{
?>
<tr>
<td><?php echo $person['contact_number'];?></td>
<td><?php echo $person['first_name'];?></td>
<td><?php echo $person['last_name'];?></td>
</tr>
<?php
}
}
?>
I get two errors total:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: contacts_array
...
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Any ideas where I went wrong?