public function update($table, $values, $tail, $tailArgs = array())
    {
        $colOK = $this->_getColumns($table);
        $query = $this->query('UPDATE ' . $table . ' SET');
        $cols = array();

        if (!($tail instanceof PDBquery)) {
            $tail = $this->query($tail, $tailArgs);
        };

        if (is_array($values)) {
            foreach ($values as $key => $val) {
                if (in_array($key, $colOK)) {
                    $cols[] = $this->query("{$key}=?", array($val));  // Array to allow NULL
                };
            };
        };
        $query->implode(',', $cols)->append($tail);
        return
            $this->_prepare($query->getQuery())->_execute($query->getArgs())
            ? $this->_sth->rowCount()
            : false
        ;
    }
public function update($table, $values, $tail, $tailArgs = array())
    {
        $colOK = $this->_getColumns($table);
        $query = $this->query('UPDATE ' . $table . ' SET');
        $cols = array();

        if (!($tail instanceof PDBquery)) {
            $tail = $this->query($tail, $tailArgs);
        };

        if (is_array($values)) {
            foreach ($values as $key => $val) {
                if (in_array($key, $colOK)) {
                    $cols[] = $this->query("{$key}=?", array($val));  // Array to allow NULL
                };
            };
        };
        $query->implode(',', $cols)->append($tail);
        return
            $this->_prepare($query->getQuery())->_execute($query->getArgs())
            ? $this->_sth->rowCount()
            : false
        ;
    }
public function update ( $ table , $ values , $ tail , $ tailArgs = array ( ) ) { $ colOK = $ this -> _getColumns ( $ table ) ; $ query = $ this -> query ( 'UPDATE ' . $ table . ' SET' ) ; $ cols = array ( ) ; if ( ! ( $ tail instanceof PDBquery ) ) { $ tail = $ this -> query ( $ tail , $ tailArgs ) ; } ; if ( is_array ( $ values ) ) { foreach ( $ values as $ key => $ val ) { if ( in_array ( $ key , $ colOK ) ) { $ cols [ ] = $ this -> query ( "{$key}=?" , array ( $ val ) ) ; // Array to allow NULL } ; } ; } ; $ query -> implode ( ',' , $ cols ) -> append ( $ tail ) ; return $ this -> _prepare ( $ query -> getQuery ( ) ) -> _execute ( $ query -> getArgs ( ) ) ? $ this -> _sth -> rowCount ( ) : false ; }
Execute UPDATE statement with variable associative column data

Note that the first time a table is referenced with insert() or
update(), its list of columns will be fetched from the database to
create a whitelist.  It is thus safe to pass a form result directly to
$values.

Also, note that if you want to append custom column assignments, it is
up to you to prepend ", " to $tail before your WHERE clause.

$tail can be a string (in which case $tailArgs specifies any arguments)
or a PDBquery object.

@param string        $table    Name of table to update
@param array         $values   Associative list of columns/values to set
@param string|object $tail     Final part of SQL query (i.e. custom columns, WHERE clause)
@param array         $tailArgs (Optional) List of values corresponding to placeholders in $tail

@return mixed Last ID if supported/available, false on failure
Execute UPDATE statement with variable associative column data