Changing db in the middle of a script |
[eluser]Skinnpenal[/eluser]
Hi guys I have CI autoloading the database library, so when the app starts it connects to database specified in my config/database.php Now, in the middle of this app, I need to connect to a different database .. replacing the current connection. How do I do this "the right way"? I tried doing Code: $this->load->database($config); EDIT: I got this to work: Code: $this->db->close(); And another question: I use database based sessions (because of freak_auth), which means that when I connect to this new database, freak_auth no longer has access to the session it created in the beginning of the script. Any ideas how to fix that?
[eluser]Chris Newton[/eluser]
You can connect to multiple databases, without closing one out. See the documentation: http://ellislab.com/codeigniter/user-gui...cting.html Bottom of the page. |
Welcome Guest, Not a member yet? Register Sign In |