Excute custom query in magento

Magento
Magento has provide us very good features for handling or interacting with Database tables. Magento give all the data by default but some time we need to get or insert some custom data.So for this we need to write custom query. Database Connections In Magento [php] <?php // fetch read database connection that is used in Mage_Core module $read= Mage::getSingleton('core/resource')->getConnection('core_read'); // fetch write database connection that is used in Mage_Core module $write = Mage::getSingleton('core/resource')->getConnection('core_write'); ?> [/php] How to excute custom query in magento [php] <?php // fetch read database connection that is used in Mage_Core module $read= Mage::getSingleton('core/resource')->getConnection('core_read'); $value=$read->query("SELECT ...."); $row = $value->fetch(); echo "<pre>";print_r($row);echo "</pre>"; // As Array ?> [/php] Insert custom data in magento tabel [php] <?php // fetch write database connection that is used in Mage_Core module…
Read More