public function update($table, array $bind, $where = '')
    {
        /**
         * Build "col = ?" pairs for the statement,
         * except for Zend_Db_Expr which is treated literally.
         */
        $set = array();
        $i = 0;
        foreach ($bind as $col => $val) {
            if ($val instanceof Zend_Db_Expr) {
                $val = $val->__toString();
                unset($bind[$col]);
            } else {
                if ($this->supportsParameters('positional')) {
                    $val = '?';
                } else {
                    if ($this->supportsParameters('named')) {
                        unset($bind[$col]);
                        $bind[':col'.$i] = $val;
                        $val = ':col'.$i;
                        $i++;
                    } else {
                        /** @see Zend_Db_Adapter_Exception */
                        // require_once 'Zend/Db/Adapter/Exception.php';
                        throw new Zend_Db_Adapter_Exception(get_class($this) ." doesn't support positional or named binding");
                    }
                }
            }
            $set[] = $this->quoteIdentifier($col, true) . ' = ' . $val;
        }

        $where = $this->_whereExpr($where);

        /**
         * Build the UPDATE statement
         */
        $sql = "UPDATE "
             . $this->quoteIdentifier($table, true)
             . ' SET ' . implode(', ', $set)
             . (($where) ? " WHERE $where" : '');

        /**
         * Execute the statement and return the number of affected rows
         */
        if ($this->supportsParameters('positional')) {
            $stmt = $this->query($sql, array_values($bind));
        } else {
            $stmt = $this->query($sql, $bind);
        }
        $result = $stmt->rowCount();
        return $result;
    }
public function update($table, array $bind, $where = '')
    {
        /**
         * Build "col = ?" pairs for the statement,
         * except for Zend_Db_Expr which is treated literally.
         */
        $set = array();
        $i = 0;
        foreach ($bind as $col => $val) {
            if ($val instanceof Zend_Db_Expr) {
                $val = $val->__toString();
                unset($bind[$col]);
            } else {
                if ($this->supportsParameters('positional')) {
                    $val = '?';
                } else {
                    if ($this->supportsParameters('named')) {
                        unset($bind[$col]);
                        $bind[':col'.$i] = $val;
                        $val = ':col'.$i;
                        $i++;
                    } else {
                        /** @see Zend_Db_Adapter_Exception */
                        // require_once 'Zend/Db/Adapter/Exception.php';
                        throw new Zend_Db_Adapter_Exception(get_class($this) ." doesn't support positional or named binding");
                    }
                }
            }
            $set[] = $this->quoteIdentifier($col, true) . ' = ' . $val;
        }

        $where = $this->_whereExpr($where);

        /**
         * Build the UPDATE statement
         */
        $sql = "UPDATE "
             . $this->quoteIdentifier($table, true)
             . ' SET ' . implode(', ', $set)
             . (($where) ? " WHERE $where" : '');

        /**
         * Execute the statement and return the number of affected rows
         */
        if ($this->supportsParameters('positional')) {
            $stmt = $this->query($sql, array_values($bind));
        } else {
            $stmt = $this->query($sql, $bind);
        }
        $result = $stmt->rowCount();
        return $result;
    }
public function update ( $ table , array $ bind , $ where = '' ) { /**
         * Build "col = ?" pairs for the statement,
         * except for Zend_Db_Expr which is treated literally.
         */ $ set = array ( ) ; $ i = 0 ; foreach ( $ bind as $ col => $ val ) { if ( $ val instanceof Zend_Db_Expr ) { $ val = $ val -> __toString ( ) ; unset ( $ bind [ $ col ] ) ; } else { if ( $ this -> supportsParameters ( 'positional' ) ) { $ val = '?' ; } else { if ( $ this -> supportsParameters ( 'named' ) ) { unset ( $ bind [ $ col ] ) ; $ bind [ ':col' . $ i ] = $ val ; $ val = ':col' . $ i ; $ i ++ ; } else { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception ( get_class ( $ this ) . " doesn't support positional or named binding" ) ; } } } $ set [ ] = $ this -> quoteIdentifier ( $ col , true ) . ' = ' . $ val ; } $ where = $ this -> _whereExpr ( $ where ) ; /**
         * Build the UPDATE statement
         */ $ sql = "UPDATE " . $ this -> quoteIdentifier ( $ table , true ) . ' SET ' . implode ( ', ' , $ set ) . ( ( $ where ) ? " WHERE $where" : '' ) ; /**
         * Execute the statement and return the number of affected rows
         */ if ( $ this -> supportsParameters ( 'positional' ) ) { $ stmt = $ this -> query ( $ sql , array_values ( $ bind ) ) ; } else { $ stmt = $ this -> query ( $ sql , $ bind ) ; } $ result = $ stmt -> rowCount ( ) ; return $ result ; }
Updates table rows with specified data based on a WHERE clause.

@param  mixed        $table The table to update.
@param  array        $bind  Column-value pairs.
@param  mixed        $where UPDATE WHERE clause(s).
@return int          The number of affected rows.
@throws Zend_Db_Adapter_Exception
Updates table rows with specified data based on a WHERE clause .