HI it's possible change the database config by $this->uri->segment() :
Code:
$active_group = 'default';
$query_builder = TRUE;
if ($this->uri->segment(1)=='my_domain_1') {
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '**********',
'password' => '***********',
'database' => '***********',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
}elseif($this->uri->segment(1)=='my_domain_2'){
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '********',
'password' => '********',
'database' => '********',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
}
I have this error
Message: Using $this when not in object context