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