I am writing here an important code snippet for getting the database connection details used in Magento
$config = Mage::getConfig()->getResourceConnectionConfig("default_setup"); $_host = $config->host; $_uname = $config->username; $_pass = $config->password; $_dbname = $config->dbname; echo $_host; ///likewise
Or you could lookup the database/details from the backend/cpanel.
@Rat – Yes we can.
Thanks, perhaps better instruction on how to implement it for those who don’t know…
Hey,
Thanks man for the quick tips on Magento.
Keep up the good work.
Thanks
where to put this code in magento to get database connection details???
@riya – You can put this in any function in your controller, or for testing you can put in any file (view,model etc)