开发者

codeigniter model problem

开发者 https://www.devze.com 2023-02-10 15:31 出处:网络
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

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' );
0

精彩评论

暂无评论...
验证码 换一张
取 消