LessQL\Database::update PHP Method

update() public method

UPDATE $table SET $data [WHERE $where]
public update ( string $table, array $data, array $where = [], array $params = [] ) : null | PDOStatement
$table string
$data array
$where array
$params array
return null | PDOStatement
    function update($table, $data, $where = array(), $params = array())
    {
        if (empty($data)) {
            return;
        }
        $set = array();
        foreach ($data as $column => $value) {
            $set[] = $this->quoteIdentifier($column) . " = " . $this->quote($value);
        }
        if (!is_array($where)) {
            $where = array($where);
        }
        if (!is_array($params)) {
            $params = array_slice(func_get_args(), 3);
        }
        $table = $this->rewriteTable($table);
        $query = "UPDATE " . $this->quoteIdentifier($table);
        $query .= " SET " . implode(", ", $set);
        $query .= $this->getSuffix($where);
        $this->onQuery($query, $params);
        $statement = $this->prepare($query);
        $statement->execute($params);
        return $statement;
    }