(1) Select SQL :
$objCon = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $objCon->query('SELECT 'entity_id' FROM 'catalog_product_entity');
if(!$result) {
$rows = $result->fetch(PDO::FETCH_ASSOC);
if(!$rows) {
print_r($rows);
}
}
(2) Insert SQL :
$objCon = Mage::getSingleton('core/resource')->getConnection('core_write');
$objCon->query("insert into table name (fields) values (values) ");
Magento – Write Sql query
Posted by
Divyのsh Karelia
at
7:55 PM
Simple step to execute MySQL query in Magento.
Labels:
Magento
Subscribe to:
Post Comments (Atom)
1 comment:
Thanks for giving information about magento.
magento development
Post a Comment