Welcome Guest, Not a member yet? Register   Sign In
Multiple Database Connections
#1

[eluser]bradya[/eluser]
Hi Everyone,

I'm relatively new to code igniter, and am having some issues with connecting to multiple databases. I've read the examples and instructions in the userguide, but am still stuck on how to properly alternate between the two.

To give you an overview:

I have 2 databases defined in database.php, one called $db['users'] and one called $db['events'].

Both work for their seperate functions when I have $active_group= set to either group.

However this seems to override any DB connections I declare myself. For example, in my Events model I have defined the DB in this fucntion:

Code:
function Event_model()
{
    parent::Model();
    $this->load->database('events');
}

Then, for example, if I try to run a query to get all the venues listed in the events table, I get back an SQL error saying "Table 'users.venue' doesn't exist", since it is obviously still trying to connect to the users DB.

So, can anyone help me out as to what exaclty I'm doing wrong. My feeling is that it has something to do with the $active_group. Do I need to set $active_group?

Any help would be greatly appreciated.


Messages In This Thread
Multiple Database Connections - by El Forum - 06-16-2008, 01:49 AM
Multiple Database Connections - by El Forum - 09-26-2008, 04:12 PM
Multiple Database Connections - by El Forum - 09-26-2008, 06:24 PM
Multiple Database Connections - by El Forum - 10-01-2008, 03:32 PM
Multiple Database Connections - by El Forum - 10-01-2008, 04:42 PM
Multiple Database Connections - by El Forum - 10-01-2008, 05:41 PM
Multiple Database Connections - by El Forum - 10-02-2008, 10:38 AM
Multiple Database Connections - by El Forum - 10-02-2008, 04:24 PM
Multiple Database Connections - by El Forum - 10-03-2008, 05:58 AM
Multiple Database Connections - by El Forum - 10-04-2008, 07:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB