Selecting data from database using Magento

Now Reading
Selecting data from database using Magento

// display all regions defined for the United States
$sql = "SELECT * FROM directory_country_region WHERE country_id='US'";
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
foreach ($connection->fetchAll($sql) as $arr_row) {
    echo $arr_row['default_name'];
}
for more magento tutorial visit: http://blog.free-extension.com/
  • feeling good when I got the answer for what I am searching for. These type of technical post will help newbies like me. Kindly go more into technical which certainly will help readers