The problem is :

              $this->set('incentive', $this->Incentive->read(null,
$id));

you set the $incentive to your view, but not in this controller ..

              $incentive = $this->Incentive->read(null, $id);
              $this->set('incentive', $incentive);



On Aug 9, 6:25 pm, gentleJuggernaut <[EMAIL PROTECTED]> wrote:
> I have a function that sets a variable for a view and then it needs to
> use a value returned to set another variable in the view.  I am
> getting an Undefined Variable error when I try to call the first
> variable.
>
> /*<code>*/
>
>         function view($id = null) {
>
>                 if(!$id) {
>                         $this->Session->setFlash('Invalid Incentive.');
>                         $this->redirect(array('action'=>'index'), null, true);
>                 }
>                 $this->set('incentive', $this->Incentive->read(null, $id));
>                 $this->set('similar', $this->Incentive->findAll("type_id = " .
> $incentive['Type']['id']));
>         }
>
> /*</code>*/
>
> The error that I get is:
>
> Notice (8): Undefined variable:  incentive [CORE/app/controllers/
> incentives_controller.php, line 21]
>
> Is there a different way that I am supposed to use to access data
> inside the controller?
>
> NSM


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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