Wednesday, 21 November 2012

magento: insert query for a custom table

$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$connection->beginTransaction();

$sql = 'INSERT INTO tableName (`field1`, `field2`) VALUES (?, ?)';
$bind = array('value1', 'value2');
$connection->query($sql, $bind);
$connection->commit();

No comments:

Post a Comment