I see many methods / tutorials for connecting multiple databases in CodeIgniter? Still far from me. Some of them provide me with the ability to connect multiple databases in CI. This is my way of using. I found it on a blog. Forgive me, I wonβt find out the blog address.
$active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'root'; $db['default']['password'] = 'root'; $db['default']['database'] = 'vk_global'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; //add alternate database settings $db['wow']['hostname'] = 'localhost'; $db['wow']['username'] = 'root'; $db['wow']['password'] = 'root'; $db['wow']['database'] = 'auth'; $db['wow']['dbdriver'] = 'mysql'; $db['wow']['dbprefix'] = ''; $db['wow']['pconnect'] = TRUE; $db['wow']['db_debug'] = TRUE; $db['wow']['cache_on'] = FALSE; $db['wow']['cachedir'] = ''; $db['wow']['char_set'] = 'utf8'; $db['wow']['dbcollat'] = 'utf8_general_ci'; $db['wow']['swap_pre'] = ''; $db['wow']['autoinit'] = TRUE; $db['wow']['stricton'] = FALSE;
i was called by this code
$DB2 = $this->load->database('auth',true);
and I inserted a simple line with this code
$this->$DB2->insert('events_grouptable',$data);
I got this error. You specified an invalid database connection group. How can I solve this error?
source share