Welcome Guest, Not a member yet? Register   Sign In
Multiple databases
#2

[eluser]Matalina[/eluser]
I don't ever use $this->db when using multiple databases.

Well I lie, I created a MY_Model to do that.

You can:
Code:
$this->db = $this->load->database('default', TRUE);
You have to do that in any model where you want to use it.
But I tend to do:

Code:
$this->db_main = $this->load->database('default', TRUE);

This is my multidatabase MY_Model construct where I use $this->db method

Code:
function __construct($database = 'default') {
    parent::__construct();
    $this->db = $this->load->database($database,TRUE);
  }


Messages In This Thread
Multiple databases - by El Forum - 04-27-2012, 11:06 AM
Multiple databases - by El Forum - 04-27-2012, 11:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB