Connecting to Multiple Databases
If you need to connect to more than one database simultaneously you can do so as follows:
$DB1 = $this->load->database('group_one', TRUE);
$DB2 = $this->load->database('group_two', TRUE);
Note: Change the words "group_one" and "group_two" to the specific group names you are connecting to (or you can pass the connection values as indicated above).
By setting the second parameter to TRUE (boolean) the function will return the database object.
When you connect this way, you will use your object name to issue commands rather than the syntax used throughout this guide. In other words, rather than issuing commands with:
$this->db->query();
$this->db->result();
etc...
You will instead use:
$DB1->query();
$DB1->result();
etc...