![]() |
undefined property - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: undefined property (/showthread.php?tid=34722) Pages:
1
2
|
undefined property - El Forum - 10-07-2010 [eluser]f0n3man[/eluser] i am having a problem getting an error message from the controller that the property Site::$site_model is undefined. the php error in the system log states: 'Call to a member function get_records() on a non-object in /path/etc...'. the get_records function exists in site_model.php. i have the database library autoloaded, and even have the model loaded in the controller, and still get the same error message. i have done this in two different installations with 2 different versions. i can access the database and pull records. from the controller. i am brand new to codeigniter, but so far am not impressed as i can't get it to work properly. any other ideas? undefined property - El Forum - 10-07-2010 [eluser]OliverHR[/eluser] Do yo call parent::Controller in your class constructor?? Post your code. undefined property - El Forum - 10-07-2010 [eluser]f0n3man[/eluser] Most of this code came from one of the wiki tutorials. I modified it in attempts to make it work. The controller is: Code: class Site extends Controller Code: class Site_model extends Model { Since I'm absolutely new to OOP programming, I'm guessing it's something simple. undefined property - El Forum - 10-07-2010 [eluser]Twisted1919[/eluser] And where do you load your model ? Should be : Code: function Site() undefined property - El Forum - 10-07-2010 [eluser]f0n3man[/eluser] That line is actually in the current itteration and still gets the same message. I have been scouring the forums looking for answers to this, and have added and deleted lines and have installed CI on 2 different servers all with the same results. When I fool with some of the settings in the configuration files, I either get Fatal Errors, or messages from CI that things aren't right. I haven't had this much trouble with an application in quite a while. undefined property - El Forum - 10-07-2010 [eluser]danmontgomery[/eluser] Linux or Windows? Is the file named correctly? undefined property - El Forum - 10-07-2010 [eluser]f0n3man[/eluser] It is on a Linux server, and I have double checked spelling and case everywhere. undefined property - El Forum - 10-07-2010 [eluser]InsiteFX[/eluser] Did you try autoloading the database in application/config/autoload.php ? InsiteFX undefined property - El Forum - 10-07-2010 [eluser]f0n3man[/eluser] yes, and loading it the model construct at one point. undefined property - El Forum - 10-07-2010 [eluser]InsiteFX[/eluser] Try loading the database in your Controller. InsiteFX |