The code seems not working.
// $counter is an instance of Zend_Db_Table_Abstract
$counter->update(array('hits' => 'hits+1'), '"id" = 1');
I took a look into the DB profiler and find the following query:
UPDATE `downloads` SET `hits` = ? WHERE ("id" = 1)
You need to use an instance of
Zend_Db_Expr(an SQL expression) to get this to work (untested):… or something similar I believe should work. Report back if it doesn’t work, and I’ll come up with a tested answer.
UPDATE:
Ok, I tested it, and it works, provided that you loose the quotes around
idin the where clause.idshouldn’t be interpreted as a literal string but as a column name. Maybe you ment to use backticks in stead? Like so ‘`id` = 1’. That is the proper way to quote an identifier for MySQL.