...undefined property - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: ...undefined property (/showthread.php?tid=40081) |
...undefined property - El Forum - 03-29-2011 [eluser]drseuss[/eluser] Ok... title says it and I can't fix it. Error: A PHP Error was encountered Severity: Notice Message: Undefined property: Account::$account_model Filename: controllers/account.php Line Number: 21 (This line is: $query = $this->account_model->login(); ) ( ! ) Fatal error: Call to a member function login() on a non-object in C:\wamp\www\application\controllers\account.php on line 21 Call Stack # Time Memory Function Location 1 0.0022 694208 {main}( ) ..\index.php:0 2 0.0076 765744 require_once( 'C:\wamp\www\system\core\CodeIgniter.php' ) ..\index.php:163 3 0.1329 4147912 call_user_func_array ( ) ..\CodeIgniter.php:297 4 0.1329 4147992 Account->login( ) ..\CodeIgniter.php:0 account.php (controller) Code: class Account extends CI_Controller { account_model.php (model) Code: class Account_model extends CI_Model { If anything else is needed just tell me ...undefined property - El Forum - 03-29-2011 [eluser]InsiteFX[/eluser] Did you load the database? You can autoload it in application/config/autoload.php InsiteFX ...undefined property - El Forum - 03-29-2011 [eluser]drseuss[/eluser] Yes I did. This is my library autoload Code: $autoload['libraries'] = array('database','session','display'); display is my own to quick load the view that I specify, with the header and footer files ...undefined property - El Forum - 03-29-2011 [eluser]InsiteFX[/eluser] Did you save your model file with all lowercase characters? Also this is wrong! Code: if($query->num_rows == 1) InsiteFX ...undefined property - El Forum - 03-29-2011 [eluser]drseuss[/eluser] Yes I've saved it as all lowercase characters... and I've made the change and it still doesn't work ...undefined property - El Forum - 03-29-2011 [eluser]InsiteFX[/eluser] You did setup all your database parameters in application/config/database.php ? This is telling me that your model is not loading! Try autoloading it and see if it works. InsiteFX ...undefined property - El Forum - 03-29-2011 [eluser]drseuss[/eluser] Yes I've set all my database info I've tried autoloading it and it isn't working. I've used the code before, but when I copied the code to my current project it stopped working.. ...undefined property - El Forum - 03-29-2011 [eluser]byde[/eluser] may be you are saving your model in a wrong folder ...undefined property - El Forum - 03-29-2011 [eluser]drseuss[/eluser] no it is in the correct folder ...undefined property - El Forum - 03-29-2011 [eluser]InsiteFX[/eluser] Try a clean install of CodeIngniter and redo it. I know some people have been having problems cutting and pasting code! InsiteFX |