I have used Zend_Db_Table update on many occasions but this time I am running into a problem. I am not sure why so please tell me where I am doing wrong.
$where = $directory->getAdapter()->quoteInto('id = ?', $id);
$total_votes = array('total_votes' => '(total_votes + 1)');
$directory->update($total_votes, $where);
/// $directory is a db table variable.
It’s not updating value in the database. I printed query using Profiler:
**UPDATE dealers_directory SET `total_votes` = ? WHERE (`id` = 3)**
I am not getting why it’s adding “?” instead of (total_votes + 1). I have used it in couple of places in same application and it’s working fine but I don’t know whats problem here.
Thanks.
Use
new Zend_Db_Expr('(total_votes + 1)').