Welcome Guest, Not a member yet? Register   Sign In
database() on a non-object
#1

[eluser]rvillalon[/eluser]
Hi everyone,

I'm creating a custom library in the applications/library folder and when I try to use the database, it gives me this error:

Fatal error: Call to a member function where() on a non-object in /public_html/stage/system/application/libraries/User.php on line 181

Code:
$this->db->where($this->tblUser, $user);
        $this->db->where($this->tblUserPass, $pass);
        $this->db->limit(1,0);
        $query = $this->db->get($this->tbl);

        if ($query->num_rows() > 0)
        {

        }
#2

[eluser]TheFuzzy0ne[/eluser]
You need to load the database before you can use it.

Code:
$this->load->database();

Alternatively, you can autoload it via the autoload.php file.
#3

[eluser]rvillalon[/eluser]
It worked, thanks!




Theme © iAndrew 2016 - Forum software by © MyBB