The ff is my database setup on my config file
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '#########';
$db['default']['database'] = 'fault_analytics';
$db['default']['dbdriver'] = 'mysql';
...
$db['SiteDB']['hostname'] = 'localhost';
$db['SiteDB']['username'] = 'root';
$db['SiteDB']['password'] = '#########';
$db['SiteDB']['database'] = 'smartSiteDB';
$db['SiteDB']['dbdriver'] = 'mysql';
...
my custom jcm_acl.php construct method:
function __construct() {
$this->ci =& get_instance();
$this->ci->load->helper('url');
$this->ci->load->library('session');
$this->ci->load->helper('string');
$this->ci->load->config('jcm_acl');
$this->ci->load->model('jcm_acl_model', 'acl');
$this->tables = $this->ci->config->item('tables');
$this->default_error_page = $this->ci->config->item('default_error_page');
$this->use_default_error_page = $this->ci->config->item('use_default_error_page');
}
I ran some debug queries to check the database captured by my get_instance()
on my custom library's __construct()
method. The ff are my debug queries:
vdebug($this->jcm_acl->ci->db->database);
vdebug($this->jcm_acl->ci->db->list_tables());
vdebug($this->jcm_acl->ci->db->get('users'));
die();
Below are the results of the debug queries:
Notice the database name being referred to by the get()
method, its not the same with the database name as shown by the first debug query. How is this happening.
This only happens when I access the page where I also load the second database. On other pages where I do not load the second database, It works perfectly fine.