To grab codeigniter database name
Just use the public variable from the Database Driver object?
$this->db->database;
it is enough to get the present(active) database in codeigniter
echo $this->db->database;
We can easily fetch the database details in codeigniter.
Just use below code and print this you will get all database related information:-
print_r($this->db);
You can use this like below:-
$this->db->database$this->db->hostname$this->db->username$this->db->password