• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with instance of CI database class

hello all,

I have a problem working with an instance of the CI database class.

I followed a tutorial of "Bramme" -> a basic login class (named "Auth").
In the class (Auth.php) an instance of the database class is loaded:
# first lines cut
function Auth($props = array())
        $this->CI =& get_instance();
        # Load additional libraries, helpers, etc.
# rest fo code here

Within one function, I'm able to access my database, for example:
$this->CI->db->where('vorname', $this->vorname);
        $this->CI->db->where('nachname', $this->nachname);
        $this->CI->db->where('mitgliedsnummer', $this->mitgliedsnummer);
        $this->CI->db->where('geburtsdatum', $this->geburtsdatum);
        $query = $this->CI->db->get($this->usertable);

I added a method to the class (a set new password function) and can't access
the db anymore using the same synthax. In the new method I tried:
$this->CI->db->where('mitgliedsnummer', $this->session->userdata('mitgliedsnummer'));

I just get an error message at this line:
Quote:Fatal error: Call to a member function on a non-object in ...

Any ideas what I'm doing wrong?

Your error isn't with the database, but the session method call.

Your calling:

Should be

ähem ... sorry for beeing blind.

thank you Drewbee!

No worries Smile It seems it's always the easy stuff that is always the hardest to find!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.