Fatal Error: Call to member function on a non-object. |
[eluser]Carl Weis[/eluser]
I followed the documentation on Models and I keep getting this error, any help would be appreciated. A PHP Error was encountered Severity: Notice Message: Undefined property: Manage::$File Filename: files/manage.php Line Number: 14 Fatal error: Call to a member function get_files() on a non-object in /var/www/uisimulator/application/controllers/files/manage.php on line 14 Here is my Model: - Located: application/models/files/file.php Code: class File extends CI_Model { Here is my Controller: Location: application/controllers/files/manage.php Code: class Manage extends CI_Controller { Inside my view I have a simple loop to show the results: Code: <?php foreach ($configFiles as $file) : ?>
[eluser]OliverHR[/eluser]
check case on word file at this line: Code: config_files['query'] = $this->file->get_files();
[eluser]Carl Weis[/eluser]
I changed it to lowercase and it still produces the same error. A PHP Error was encountered Severity: Notice Message: Undefined property: Manage::$files Filename: files/manage.php Line Number: 14 Fatal error: Call to a member function get_files() on a non-object in /var/www/uisimulator/application/controllers/files/manage.php on line 14
[eluser]Carl Weis[/eluser]
Is there a way to make sure Code Igniter is connecting to my database?
[eluser]Bart v B[/eluser]
Where is $configFiles comming from? Code: class Manage extends CI_Controller { view file: Code: <?php foreach ($query as $file) : ?>
[eluser]InsiteFX[/eluser]
Message: Undefined property: Manage::$File file is a php reserved word! $config_files is being passed to the view as data just like $data! Code: <?php foreach ($configFiles as $file) : ?> InsiteFX
[eluser]OliverHR[/eluser]
[quote author="InsiteFX" date="1313297366"]Message: Undefined property: Manage::$File file is a php reserved word! $config_files is being passed to the view as data just like $data! Code: <?php foreach ($configFiles as $file) : ?> Actually __FILE__ is a predefined constants but not $file.
[eluser]Aken[/eluser]
This is not an issue of a reserved name - I was able to create a model called File no problem. You're loading the model incorrectly. If you're trying to use the auto connect to DB parameter, you need to include a blank second parameter first. Code: $this->load->model('files/file', '', TRUE);
[eluser]OliverHR[/eluser]
[quote author="InsiteFX" date="1313365394"]Oh really![/quote] Yes really: http://php.net/manual/en/reserved.php http://www.php.net/manual/en/reserved.keywords.php |
Welcome Guest, Not a member yet? Register Sign In |