Tuesday, August 27, 2013

Notice (8): Undefined variable:

hello people I'm with a little problem on my cake 2.2.1

good staff my mistake and the next I'm creating a query and when I call the variable that received this query
in my view the error Notice (8): Undefined variable: my function on controller this way;

function to list the banks
public function setBancos ()
     {
  
         $ banks = $ this-> Database-> find ('list', array (
                     'fields' => array ('Banco.id', 'Banco.nome')
                     'order' => 'ASC Banco.nome'
                     'recursive' => -1
                 )
             );
         $ this-> set ('database', $ banks);
   
     }

a view like this

<?
echo $ banks

?>

I want to appear in all banks view more of this error Notice (8): Undefined variable: you guys can help me?
when I generate the crud by automatic cake bake all it brings me more listing everything right when I create the cake manual identifies the variable is not passed by the controller $ this-> set ('database', $ banks), in my view if someone could helps me will be grateful!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: