How to Create a custom Database connection in Magento?
Create a connectdb.php file in your root folder. And paste the following code. Now
you are able to access Data base on your file.
1. require_once ("app/Mage.php");
2. $app = Mage::app('default');
3. $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
4. $dbinfo = array("host" => $config->host, "user" => $config->username,"pass" => $config->password, "dbname" => $config->dbname);
5. $hostname = $dbinfo["host"];
6. $user = $dbinfo["user"];
7. $password = $dbinfo["pass"];
8. $dbname = $dbinfo["dbname"];
9. $con = mysql_select_db($dbname,mysql_connect($hostname,$user,$password));
Really good to know about custom database, and its very informative. Thanks for these kind of posts, and keep updating.
ReplyDeletebuy basra pearl online
Very nice blog and pretty well maintained. Keep it up and thanks for the post, keep updated.
ReplyDeleteomega 3 fatty acids capsules
Really good to know about the custom database in magento, thanks for it.
ReplyDeletecolon cancer surgery in india
Best Ovarian Cysts Treatment In Delhi
ReplyDeleteUmbilical Hernia Treatment In Delhi
Best Hernia Treatment Delhi