I've this trouble with CakePHP update. I try to update a row in my DB with that function (see below):
function updateRow($amount, $user_id){
$user_balance = $this->getUserBalance($user_id);
//now update
$balance['Balance']['id'] = $user_balance['Balance'][id];
$balance['Balance']['amount'] = $user_balance['Balance'][amount] + $amount;
$this->Balance->save($balance);
}
If I call it ONE time , like:
$this->updateRow(100,5);
it's all ok. But if I try to call it two or more times , like:
$this->updateRow(100,5);
$this->updateRow(200,5);
$this->updateRow(150,5);
the function was called but only the last update was actually done in db !! (eg. initial amount value was 100. At the end of three call I expected amount value was 550 but it is 250 !)
Have you solutions for this ? thx in advance