Hey guys, I am getting an Undefined index error when I am trying to
get Projects based on project name.

Error:
------------------------------
Undefined index:  Project [APP\views\projects\view.ctp, line 16]

Here's the code involved:

Controller
-----------------------------------------------

        function view($name)
        {
                $projects = $this->Project->findByName('UPI');
                $this->set('projects', $projects);
        }


View
----------------------------------------------

        <?php foreach($projects as $project): ?>

                <?php echo $project['Project']['name']; ?>

        <?php endforeach ?>

Debug output
-------------------------------------------------
<?php
        echo debug($projects);
?>

outputs

Array
(
    [Project] => Array
        (
            [id] => 3
            [name] => UPI
            [description] => Meeting that was scheduled with customer
was postponed.
            [user_id] => 1
            [created] => 2009-03-24 08:18:01
            [modified] => 2009-03-25 11:49:43
        )

    [User] => Array
        (
            [id] => 1
            [jobTitle] => Software Engineer
            [team] => Dev Ops
            [firstName] => jon
            [lastName] => smith
            [username] => jsmith
            [password] => test
            [email] => [email protected]
            [created] => 0000-00-00 00:00:00
            [modified] => 2009-03-24 08:16:35
        )

)

Thanks for any help!

Chris



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to