If you want to run a raw query from your magento module it is possible using the following codes:
Open db connections
Read connection : $db = mage::getSingleton('core/resource')->getConnection('core_read');
Write connection : $db = mage::getSingleton('core/resource')->getConnection('core_write');
Execute your query given in $query
Run Query: $db->query($query);
Finally fetch results:
Fetch Results (array): $db->fetch();
Good snippet..
ReplyDeleteNice tips! thanks for sharing, Magento Modules
ReplyDelete