CodeIgniter Forums
database info - retrievable? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: database info - retrievable? (/showthread.php?tid=20037)

database info - retrievable? - El Forum - 06-25-2009

Hey, my apologies if this has already been asked, but my quick glance through forum searching didn't find anything.

Is there a way in a controller (or model) to retrieve the database information stored in the database.php config file?

I need the info stored in
$db['default']['database'] = "db_name";

Please help,


database info - retrievable? - El Forum - 06-25-2009

you can include the database file, and then access the $db array variable

include APPPATH.'config/databae.php';
echo $db['default']['database'];