Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multi database codeigniter

Say I have 2 db configs:

$db['default']
$db['alternate']

And say I have loaded a db:

$this->load->db($db);

How can I check and see which db I've loaded?

Yes, I know you add a 2nd parameter and return the actual database, but that won't work for my current scenario. No, I can't just do a string compare of $db (we can assume we are in a totally different method or something where I don't [and can't] have access to $db)

like image 328
Aram Papazian Avatar asked Aug 05 '26 16:08

Aram Papazian


1 Answers

Dont know if that's any help, but you can see loaded db configuration by accessing eg. $this->db->database this will return the database name that you are currently using

like image 93
Pav Avatar answered Aug 07 '26 05:08

Pav