Question: I have a cakePHP problem - I want to make a update query like this

`UPDATE table SET field = field + some_var` 

and I don't know how to do it...

Can anyone help me?

Answer: 
The only "right" way would be using cake's "atomic query" wrapper methods. In your case that would be "updateAll".
The question is a complete duplicate of a dozen other questions - like [Incrementing Cakephp database field by a value](https://stackoverflow.com/questions/8689203/incrementing-cakephp-database-field-by-a-value)

```
$var = 1;
$this->Article->updateAll(
    array('Article.viewed' => 'Article.viewed + ' . $var),                    
    array('Article.id' => $id)
);

```

This is also in the docs: <http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-updateall-array-fields-array-conditions>
You can use the callback method beforeSave to implement what you need.

[Callback Method: BeforeSave](http://book.cakephp.org/2.0/en/models/callback-methods.html#beforesave)

```
public function beforeSave($options = array()) {
    if (!empty($this->data['table']['field'])){
         $this->data['table']['field'] += $this->data['table']['some_var'];
    }
    return true;
}

```