src/MVC/DataBase/Model.php
protected function update(array $data = array(), array $criteria)
    {
        $set = array();
        foreach ($data as $columnName => $value) {
            $set[] = "$columnName = ?";
        }
        
        $params = array_merge(array_values($data), array_values($criteria));
        
        $sql = "UPDATE $this->_table SET " . implode(', ', $set)
                . " WHERE " . implode(' = ? AND ', array_keys($criteria)) . " = ?";
        
        $pdos = $this->_pdo->prepare($sql);
        
        $pdos->execute($params);
        
        return $pdos->statement()->rowCount();
    }
protected function update(array $data = array(), array $criteria)
    {
        $set = array();
        foreach ($data as $columnName => $value) {
            $set[] = "$columnName = ?";
        }
        
        $params = array_merge(array_values($data), array_values($criteria));
        
        $sql = "UPDATE $this->_table SET " . implode(', ', $set)
                . " WHERE " . implode(' = ? AND ', array_keys($criteria)) . " = ?";
        
        $pdos = $this->_pdo->prepare($sql);
        
        $pdos->execute($params);
        
        return $pdos->statement()->rowCount();
    }
protected function update ( array $ data = array ( ) , array $ criteria ) { $ set = array ( ) ; foreach ( $ data as $ columnName => $ value ) { $ set [ ] = "$columnName = ?" ; } $ params = array_merge ( array_values ( $ data ) , array_values ( $ criteria ) ) ; $ sql = "UPDATE $this->_table SET " . implode ( ', ' , $ set ) . " WHERE " . implode ( ' = ? AND ' , array_keys ( $ criteria ) ) . " = ?" ; $ pdos = $ this -> _pdo -> prepare ( $ sql ) ; $ pdos -> execute ( $ params ) ; return $ pdos -> statement ( ) -> rowCount ( ) ; }
Function SQL UPDATE
@access protected
@param array $data
@param array $criteria
@return int
Function SQL UPDATE