Welcome Guest, Not a member yet? Register   Sign In
Session to Database + Multiple Database
#1

[eluser]Unknown[/eluser]
Hello,

I want now that the sessions will be save in my database.
But my default database is not my database for stuffs like ci_sessions.

I found this:
Tutorial

So I edited the Session.php in system/lib with:
Code:
// Are we using a database?  If so, load it
  if ($this->sess_use_database === TRUE AND $this->sess_table_name != '')
  {
    $this->CI->load->database('stuff', TRUE);
  }

But the system still want connect to my default database :/

Someone a solution to get the session_db on my stuff_database?


Thanks Smile
Sanjo
#2

[eluser]XMadMax[/eluser]
Samjo,

Code:
$this->CI->load->database('stuff', TRUE);

This load the stuff configuration, and returns the pointer to this connection. You must use:

Code:
$this->stuffdb = $this->CI->load->database('stuff', TRUE);

And use $this->stuffdb instead of $this->db

Also, another solution would be to create a db function inside session. When $this->db are called, you can return your own database, instead of default database.

Xavier




Theme © iAndrew 2016 - Forum software by © MyBB