![]() |
Models aren't loading - why is that? - 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: Models aren't loading - why is that? (/showthread.php?tid=5150) |
Models aren't loading - why is that? - El Forum - 01-08-2008 [eluser]yarek[/eluser] Hello. I know, I know... it was discussed so many times, I searched the forums but nothing helped. Problem: "Call to a member function on a non-object in C:\http\cms\system\application\models\entry.php on line 17" Here is my code: cms.php Code: <?php entry.php Code: <?php I tried everything, I changed all names to lowercase etc and it didn't work. I tried model('', TRUE); and it didn't help me too ![]() And what is interesting: it sees problem on the 17th line! There is a similliar function on 11th line and it doesn't see that. Strange? Models aren't loading - why is that? - El Forum - 01-08-2008 [eluser]xwero[/eluser] have you autoloaded the database else you have to add Code: $this->load->database() Models aren't loading - why is that? - El Forum - 01-08-2008 [eluser]nirbhab[/eluser] hi, i am not sure, but the way i use model is: Code: $this->load->model('Entry','Entry',TRUE); Please try this and mention the error if possible. Models aren't loading - why is that? - El Forum - 01-09-2008 [eluser]Dr.Dan[/eluser] Code: $this->db->orderby('modified', 'desc'); Make sure you have a column 'modified', and it is correctly spelled. Models aren't loading - why is that? - El Forum - 01-09-2008 [eluser]andreagam[/eluser] Yarek, I think you should call the model like this: Code: $this->load->model('entry'); That is, the name of the file in lower case. Try that Andrea Models aren't loading - why is that? - El Forum - 01-09-2008 [eluser]yarek[/eluser] @andrea, Lowercase or uppercase - it doesn't work, I already tried that. @Dr. Dan, the name of column is correct, it's not the problem of database because there would occut another error message, right? I think so... I checked it. Models aren't loading - why is that? - El Forum - 01-09-2008 [eluser]tonanbarbarian[/eluser] is active record turned on config/database.php Code: $db['default']['active_r'] = TRUE; Models aren't loading - why is that? - El Forum - 01-09-2008 [eluser]yarek[/eluser] [quote author="tonanbarbarian" date="1199929438"]is active record turned on config/database.php Code: $db['default']['active_r'] = TRUE; Yes, it's and it was turned on ![]() Why do you think that the problem is in the database? I rather think that it's something with loading models, they just can't load. Models aren't loading - why is that? - El Forum - 01-09-2008 [eluser]yarek[/eluser] [quote author="xwero" date="1199848845"]have you autoloaded the database else you have to add Code: $this->load->database() Omg, I feel so ashamed... I didn't load this. The problem is resolved - I loaded database class in the controller's contructor. It works! Thank you all for replies. I didn't know about loading database class because I didn't know I have to do that. Victory! |