![]() |
$this->db->get() returning an error - 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: $this->db->get() returning an error (/showthread.php?tid=37439) |
$this->db->get() returning an error - El Forum - 01-10-2011 [eluser]Piero[/eluser] Hey, Following the second video tutorial, I've got this simple controller: Code: <?php And when I call the page I've go this error: A PHP Error was encountered Severity: Notice Message: Undefined property: Artist::$db Filename: controllers/artist.php Line Number: 22 Fatal error: Call to a member function get() on a non-object in /var/www/marie/system/application/controllers/artist.php on line 22 Since my class extends the Controller class, how come that $db is not recognized? I don't get it... $this->db->get() returning an error - El Forum - 01-10-2011 [eluser]Gerep[/eluser] are you loading the database? $this->db->get() returning an error - El Forum - 01-10-2011 [eluser]Bart Mebane[/eluser] You need to load the database class before you can use it Code: $this->load->database(); $this->db->get() returning an error - El Forum - 01-10-2011 [eluser]Piero[/eluser] Sweet. It's working now. Whether I missed it, whether it wasn't said clearly in the tutorial that you had to load it... Thanks! |