So far in codeigniter 3 we can get database name and table prefix (as mentioned in config/database.php
) from the below code lines:
echo $this->db->database;
echo $this->db->dbprefix('emp_table');
Now how can we call these values in Codeigniter 4?
I think in Codeigniter 4.0.1 this is what you are looking for
$db = \Config\Database::connect();
$Database = $db->database();
$DBPrefix = $db->getPrefix();
I hope this work for you