我正在使用以下更新查询,
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$query = UPDATE `catalog_product_entity_decimal` val SET val.value = '11'
WHERE val.attribute_id = 75 AND
val.entity_id = (select cv.entity_id from `catalog_product_entity` as cv where cv.sku = '25' limit 1)
$afected = $db->query($query);
如何从上述查询中获取受影响的行数?我已经看过了 https://magento.stackexchange.com/questions/10623/how-do-i-get-the-mysql-affected-rows-using-the-magento-resource - 但那些不适合我的。
请在上面提出建议。
答案 0 :(得分:2)
您需要使用$db->exec($query);
代替$db->query($query);
。它返回受影响的行数。