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

[eluser]louis w[/eluser]
I have two databases set in my database config. One as ['default'], which is the one I will primarily be using. On a rare occasion I will need to connect to another one.

Inside my model I perform my normal db queries (on the default database) and then if I need to connect to the other one I load it this way:
$db_teaser = $this->CI->load->database('db_teaser', TRUE);

However the problem arises that if later on in my model I want to query the default database again (e.g. $this->db->simple_query), it doesn't work. It's trying to connect to the second database loaded.

Is there a way for $this->db to always query the default database and the second one to work with $db_teaser?

Problem with loading the default database not as $this->db is that when I dont have two databases loaded I would still have to reference it like this.

Thanks. Hope this is clear.


Messages In This Thread
Multiple Database Question - by El Forum - 01-22-2009, 09:17 AM
Multiple Database Question - by El Forum - 01-22-2009, 09:18 AM
Multiple Database Question - by El Forum - 01-26-2009, 04:49 PM
Multiple Database Question - by El Forum - 01-26-2009, 05:44 PM
Multiple Database Question - by El Forum - 01-26-2009, 07:52 PM
Multiple Database Question - by El Forum - 01-27-2009, 08:49 AM
Multiple Database Question - by El Forum - 01-27-2009, 09:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB