Zend_Db_Table_Abstract::update PHP Method

update() public method

Updates existing rows.
public update ( array $data, array | string $where ) : integer
$data array Column-value pairs.
$where array | string An SQL WHERE clause, or an array of SQL WHERE clauses.
return integer The number of rows updated.
    public function update(array $data, $where)
    {
        $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name;
        return $this->_db->update($tableSpec, $data, $where);
    }

Usage Example

 public function update($id, $state, $info)
 {
     $data = array('state' => $state, 'info' => $info, 'lastupdate' => time());
     $found = $this->find($id);
     if ($found) {
         $data = array_merge($found, $data);
         unset($data['id']);
         $this->dbTable->update($data, array('id = ?' => $id));
     } else {
         $data['id'] = $id;
         $data['sticked'] = 0;
         $this->dbTable->insert($data);
     }
 }
All Usage Examples Of Zend_Db_Table_Abstract::update