CodeIgniter: Can't load database from within a model

Posted by thedp on Stack Overflow See other posts from Stack Overflow or by thedp
Published on 2010-04-21T21:48:45Z Indexed on 2010/04/21 21:53 UTC
Read the original article Hit count: 884

Filed under:
|
|
|

Hello,

I've written a new model for my CodeIgniter framework. I'm trying to load the database from within the constructor function, but I'm getting the following error:

Severity: Notice
Message:  Undefined property: userdb::$load
Filename: models/userdb.php
Line Number: 7

Fatal error:  Call to a member function database() on a non-object in 
/var/www/abc/system/application/models/userdb.php on line 7

Here is my model:

<?php

class userdb extends Model {

    function __construct() {

        $this->load->database();

    }
?>

What am I doing wrong here?

Thank you.

© Stack Overflow or respective owner

Related posts about codeigniter

Related posts about model