Welcome Guest, Not a member yet? Register   Sign In
cannot switch database groups
#1

[eluser]Neil_W[/eluser]
Hello,
I have multiple groups in my database.php file and I want to switch between them in code because I simply need to use different databases/tables at different times with different users.

In my controller constructor I have this:

function Admin()
{
parent::MY_Controller();
$this->load->library('session');
$this->load->database('l4session');
}

However, when I try and use the database it is still using 'default' rather than 'l4session', and I have not autoloaded database. If I modify $active_group to use 'l4session' it works fine. So it's as if passing in the parameter has no effect.

Am I doing something wrong?

Thanks for any help.
#2

[eluser]Neil_W[/eluser]
Ah, I spotted my mistake Smile

Seem I have to load the database before I load the session library.




Theme © iAndrew 2016 - Forum software by © MyBB