Also, one other question,...how do I access child object data like the
userName of the User object:
The below code gives the following error: Undefined index:  User [APP
\views\projects\view.ctp, line 16]

Thanks!

<table>
        <?php foreach($projects['Project'] as $project): ?>
        <?php $dateTime = date_create($project['created']); ?>
        <tr>
                <td>
                        <span style="font-weight:bold;"><?php echo 
$project['name']; ?></
span><br />
                        <span style="font-size:12px"><?php echo $project['User']
['username'] . " - " . date_format($dateTime, 'd/M/y'); ?></span>
                </td>
        </tr>
        <tr>
                <td style="padding-top: 10px;">
                        <?php echo $project['description']; ?>
                </td>
        </tr>
        <tr>
                <td><br /></td>
        </tr>
        <?php endforeach ?>
</table>

On Mar 20, 9:55 am, scs <scs2...@gmail.com> wrote:
> In your view try this:
>
>         <?php foreach($projects['Project'] as $project): ?>
>                 <?php echo $project['name']; ?>
>         <?php endforeach ?>
>
> The reason this is happen is because your pulling data from your user
> table but only calling for one user and looking for multi projects for
> that user.
>
> If you want just the projects name and info and not all the other
> information do a search on the projects table based on the user_id.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to