How update a database table record in Zend? How update a database table record in Zend? php php

How update a database table record in Zend?


$data = array(   'field1' => 'value1',   'field2' => 'value2');$where = $table->getAdapter()->quoteInto('id = ?', $id)$table = new Table();$table->update($data, $where);


Since you're already fetching the row you want to change, it seems simplest to just do:

$row->id = 2;$row->save();


just in case you wanna increment a column use Zend_Db_Expreg:

$table->update(array('views' => new Zend_Db_Expr('views + 1')),$where);