buki\Pdox::update PHP Method

update() public method

public update ( $data )
    public function update($data)
    {
        $query = 'UPDATE ' . $this->from . ' SET ';
        $values = [];
        foreach ($data as $column => $val) {
            $values[] = $column . '=' . $this->escape($val);
        }
        $query .= is_array($data) ? implode(',', $values) : $data;
        if (!is_null($this->where)) {
            $query .= ' WHERE ' . $this->where;
        }
        if (!is_null($this->orderBy)) {
            $query .= ' ORDER BY ' . $this->orderBy;
        }
        if (!is_null($this->limit)) {
            $query .= ' LIMIT ' . $this->limit;
        }
        return $this->query($query);
    }