multi database connection problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: multi database connection problem (/showthread.php?tid=44637) |
multi database connection problem - El Forum - 08-22-2011 [eluser]mic[/eluser] Hi, I am having a problem while connecting to multi databases with CI 2.0.0. currently i have two databases one for the normal site data and another for a demo account. I want to be able to swap between the databases based on a session variable being set or not. so far this is the code i have tried: Code: class Admin extends CI_Controller Code: $db['default']['hostname'] = 'localhost'; can anyone point me in the right direction with this? I am now at a loss as to what i should now be changing to get this to work. Thanks Mic EDIT --------------------------------------------------------------------- PS: I have this included in the constructors in all the controller, models and libraries that require the connection but i can oonly get it to connect to the default database. |