I wasn't able to populate the state combo box due to incorrect
relationships between models. Now everything is working fine.
It is so impt to make sure all models are linked to one another
correctly. Otherwise nothing works.


On Jul 6, 12:02 pm, varai <[email protected]> wrote:
> Hi,
>
> I'm trying to populate the state combo box from the states table in db
> and i'm getting the following error:
>
> Notice (8): Undefined property: AppModel::$State [APP\controllers
> \students_controller.php, line 7]Code    }*/
>     function add(){
>         $state=$this->Student->MerryParent->State->find('list',
> array('fields'=>array('State.id','State.name')));
> StudentsController::add() - APP\controllers\students_controller.php,
> line 7
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> Fatal error: Call to a member function find() on a non-object in C:
> \wamp\www\merry_flowers\controllers\students_controller.php on line 7
>
> The following is my code:
> class StudentsController extends AppController{
>
>         function add(){
>                 $state=$this->Student->MerryParent->State->find('list',
> array('fields'=>array('State.id','State.name')));
>
> I have checked all the model relationships and don't see anything
> wrong. Does anyone know on what I am doing?
> thank you.
>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to