I want to access data from two different database.
I want to print the records from two database into same view.
Now my first query is from the another database then the second query is from default database. So I get an error that SecondDatabase.tablenmae doesn't exist and actually the table is in default database
So I defined them like this:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'biz_prov';
$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;
$db['bizlms']['hostname'] = 'localhost';
$db['bizlms']['username'] = 'root';
$db['bizlms']['password'] = '';
$db['bizlms']['database'] = 'bizlms';
$db['bizlms']['dbdriver'] = 'mysql';
$db['bizlms']['dbprefix'] = '';
$db['bizlms']['pconnect'] = FALSE;
$db['bizlms']['db_debug'] = TRUE;
$db['bizlms']['cache_on'] = TRUE;
$db['bizlms']['cachedir'] = '';
$db['bizlms']['char_set'] = 'utf8';
$db['bizlms']['dbcollat'] = 'utf8_general_ci';
$db['bizlms']['swap_pre'] = '';
$db['bizlms']['autoinit'] = TRUE;
$db['bizlms']['stricton'] = TRUE;
Now In My View I have a row in which I fetch data from default database.
And then in second row I want data from another database so, I load that database:
$this->db = $this->load->database('bizlms', TRUE);
But I for my first row where I fetch data from the default database I get an error:
Table bizlms.tablname doesn't exist
How to use both database on same view?