php - How to get result set or affected row after raw SQL update in Phalcon

I am using the following raw SQL update:

$query = "UPDATE $table SET balance = balance + $this->sum WHERE cashbox_id = $cashboxId";

$db->execute($query);

Now I need the final balance, that has been updated, because I need to insert the changed balance in another table. How can I achieve this?

I need to use only raw SQL on this one.

Answer

Solution:

You can use trigger to do the trick. You can define the trigger in your sql server.

Source