src/Laito/Database.php
public function update($fields)
    {
        // Set fields
        $this->fields($fields);

        // Resolve fields
        $fields = $this->getUpdateFieldsString();

        // Define wheres
        $where = $this->getWhereString();

        // Build query
        $this->query = 'UPDATE ' . $this->table . ' SET ' . $fields . ' '. $where;

        // Prepare statement
        $this->statement = $this->pdo->prepare($this->query);

        // Bind fields values
        $this->bindFields();

        // Bind where values
        if (count($this->wheres)) {
            $this->bindWheres();
        }

        // Execute statement
        $result = $this->statement->execute();

        // Reset values
        $this->reset();

        // Return result
        return $result;
    }
public function update($fields)
    {
        // Set fields
        $this->fields($fields);

        // Resolve fields
        $fields = $this->getUpdateFieldsString();

        // Define wheres
        $where = $this->getWhereString();

        // Build query
        $this->query = 'UPDATE ' . $this->table . ' SET ' . $fields . ' '. $where;

        // Prepare statement
        $this->statement = $this->pdo->prepare($this->query);

        // Bind fields values
        $this->bindFields();

        // Bind where values
        if (count($this->wheres)) {
            $this->bindWheres();
        }

        // Execute statement
        $result = $this->statement->execute();

        // Reset values
        $this->reset();

        // Return result
        return $result;
    }
public function update ( $ fields ) { // Set fields $ this -> fields ( $ fields ) ; // Resolve fields $ fields = $ this -> getUpdateFieldsString ( ) ; // Define wheres $ where = $ this -> getWhereString ( ) ; // Build query $ this -> query = 'UPDATE ' . $ this -> table . ' SET ' . $ fields . ' ' . $ where ; // Prepare statement $ this -> statement = $ this -> pdo -> prepare ( $ this -> query ) ; // Bind fields values $ this -> bindFields ( ) ; // Bind where values if ( count ( $ this -> wheres ) ) { $ this -> bindWheres ( ) ; } // Execute statement $ result = $ this -> statement -> execute ( ) ; // Reset values $ this -> reset ( ) ; // Return result return $ result ; }
Performs an UPDATE query

@param array $fields Array of columns names and values to insert
@return bool Query success or fail
Performs an UPDATE query