CodeIgniter Forums
database info - retrievable? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: database info - retrievable? (/showthread.php?tid=20037)



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

[eluser]theprodigy[/eluser]
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
Code:
$db['default']['database'] = "db_name";

Please help,

Thanks


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

[eluser]Dam1an[/eluser]
you can include the database file, and then access the $db array variable

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