Welcome Guest, Not a member yet? Register   Sign In
Is it possible the change the active_group on the fly?
#1

[eluser]RJ[/eluser]
Hello,

The program I built can work on one of two databases (1.x,2.x); Based on a user selection I want to change the active_group to select the correct database.

I know I can change the db with $db = $this->load->database('xxx');

In doing so I would have to go back and change all my queries I believe ($this->db becomes $db->query); so changing the active_group seems to be the best solution... now is it possible?
#2

[eluser]Colin Williams[/eluser]
Just doing $this->load->database('group_name'); will append it to the Controller like you want. You could do it early on, like in the controller constructor. Just remember not to autoload it in any way
#3

[eluser]RJ[/eluser]
Tried that didn't seem to like it. I ended up doing this:

<code>$this->db = $this->load->database('v8', TRUE);</code>

Seems to work well! Thanks




Theme © iAndrew 2016 - Forum software by © MyBB