I am trying to connect to a different database than what is in my database config file.
I've been able to do this with the following in my model:
$wp['hostname'] = "localhost";
$wp['username'] = "root";
$wp['password'] = "";
$wp['database'] = "transfer";
$wp['dbdriver'] = "mysql";
$wp['dbprefix'] = "";
$wp['pconnect'] = FALSE;
$wp['db_debug'] = TRUE;
$wp['cache_on'] = FALSE;
$wp['cachedir'] = "";
$wp['char_set'] = "utf8";
$wp['dbcollat'] = "utf8_general_ci";
$wpDB = $this->load->database($wp, TRUE);
and then running queries like so: $query = $wpDB->get();
I can only get it to work when the config values are in the model itself (so there would be a lot of duplication). I've tried putting the config array in the constructor, but I get an error that it can't find it.
Where can I put the config array so I don't have to duplicate it and that's available throughout the model?