I updated to CI 2.0 now my models stopped working.I used
parent::__construct();
And i defined the class correctly extends CI_Model but even using a simple ge开发者_运维知识库t all
$query = $this->db->get('mytable');
Returns an error
Call to a member function get() on a non-object in models\crudModel.php on line 13
I'm sure its related to the update since they worked fine before.Thanks.
It sounds very much like you are not loading the database library - have you got it in your config/autoload.php? It is sensible to autoload it if you use the database library in all your controllers:
$autoload['libraries'] = array( 'database' );
精彩评论