I want a helper which will save only one specific column in database table(not eav).
-
Can you give a scenario of what you are trying to achieve.– Marius ♦Oct 3, 2013 at 8:14
-
For example i have a table with a column named 'flag'.. and i want to update only the value in 'flag' without having to save the whole row.– user2656802Oct 3, 2013 at 8:17
-
If you can explain the whole task you wanna accomplish, we may be able to explain you clearly.– ShathishOct 3, 2013 at 11:28
2 Answers
Study Magento DB classes and use them. They extend Zend DB adapters so you can do the same things. If data you want to save is part of a model, then you can safely set Model entity id and the updated field and save.
not 100% sure if you mean that but maybe you want to do it directly like that:
/**
* Get the resource model
*/
$resource = Mage::getSingleton('core/resource');
/**
* Retrieve the write connection
*/
$writeConnection = $resource->getConnection('core_write');
/**
* In your case I guess UPDATE something
*/
$query = "some-sql-query;
/**
* Execute the query
*/
$writeConnection->query($query);