Connect to magento database

As the first of creating the install script we need to establish magento database connection. For include the app/Mage.php file in the script as shown below.

Please refer my tutorial which explains how to import magento products and add attribute options programmatically.

require_once '../app/Mage.php';
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));

Share this Tutorial