How to run Custom Mysql Query in Magento
Created a test file( abc.php) in my magento root folder & written a custom query on this file.<?php
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app();
$i = 1;
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql = "SELECT `e`.* FROM `customer_entity` AS `e` WHERE (`e`.`entity_id` = '12')";
$collection = $connection->fetchAll($sql);
?>
No comments:
Post a Comment