Establish magento database connection

For creating the static block as first step we need to create a database connection

<?php
require_once '../app/Mage.php';

ini_set('display_errors', 1);
Mage::app('admin');
Mage::setIsDeveloperMode(true);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$storeId = Mage::app()->getWebsite()->getDefaultGroup()->getDefaultStoreId();

Share this Tutorial