![]() |
Getting the following message: Using $this when not in object context in - 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: Getting the following message: Using $this when not in object context in (/showthread.php?tid=2460) |
Getting the following message: Using $this when not in object context in - El Forum - 08-07-2007 [eluser]kwhitaker[/eluser] Good morning, I finally got my Apache/PHP/Mysql woes straightened out and I am trying to get cracking on this app I need to create, and I'm hitting a stumbling block. All that my code is doing right now is querying a table, getting the data and then passing it to my view. The code looks like this: Model Code: class Articles_model extends Model Controller Code: $this->load->model('Articles_model'); When I attempt to access the page it tells me: Fatal error: Using $this when not in object context in /var/www/dev/dsn/system/application/controllers/articles.php on line 2 I've tried to use the following code (researched from the various helper threads) Code: $CI = get_instance(); But then I get this message instead: Severity: Notice Message: Trying to get property of non-object Filename: controllers/articles.php Line Number: 4 Fatal error: Call to a member function model() on a non-object in /var/www/dev/dsn/system/application/controllers/articles.php on line 4 Any help is appreciated, as right now I can't even get CI to return the data I need. Also keep in mind that I'm a CI newb, though I am trying! Getting the following message: Using $this when not in object context in - El Forum - 08-07-2007 [eluser]kwhitaker[/eluser] Bleh, nevermind. I was leaving out my class call. Duh. Sorry for the trouble. |