I've debugged the view page just to confirm the data were properly collected. And indeed I have this:
[Friend] => Array
(
[0] => Array
(
[id] => 2
[username] => James_Baker
[password] => 7pooplllLLKMKMKKkss09koskld1d9b5e6
[first_name] => James
[last_name] => Baker
[email] => D-W-James@yahoo.com
[group_id] => 2
[created] => 2011-01-10 08:25:52
[modified] => 2011-02-04 17:30:47
[slug] =>
....
....
As I tried displaying on my view page, from my view.ctp here's what I currently use:
..
<?php foreach ($users as $user): ?>
<tr>
<td><?php echo $user['Friend']['username']; ?></td>
</tr>
<?php endforeach; ?>
..
but I'm getting this error:
Undefined index: username
Can someone fix the error based on the debug code I have ? I'm trying to output/echo the friend's username.