Jan 21, 2010
Queries in Magento
I am describing here the method for executing custom MySQL queries in Magento.
<?php
//select query
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
//make connection
$qry = "select name FROM user_data WHERE id=1 LIMIT 1 "; //query
$res = $read->fetchRow($qry); //fetch row
$name = $res['name']; //outputs name
//other form
$qry =...
read more
