Skip to content

Update method #3

@Exigency

Description

@Exigency

Just noticed the update method is missing a 'WHERE' clause in the query builder.

public function update($table, array $data, $where = array())
{
(...)
  // handle where clause
    if (!empty($where)) {
        $sql .= " WHERE "; // <-- Needs to be added
        if (!$this->_isAssociative($data) || !$this->_isAssociative($where)) {
            throw new Exception('Update requires $data and $where to be associative.');
        }
(...)
}

Superb class by the way, it's very clean and pragmatic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions