php – How can I add a value to a row in the db without having to add variables?

Question:

Well my question is like this:

I have the row balance of a given user from my database table that has €100, and I wanted to add €50, how can I do it without having to create a variable with his current balance, plus a variable with the balance to add, plus a variable with the sum of the two values ​​and then insert it into the database.

Is there a faster way to add values ​​to the database without having to do this process all the time?

Thanks.

Answer:

The fastest way I know of would be using just one UPDATE :

UPDATE tbl_usuario SET vl_saldo = vl_saldo + 50 WHERE id_usuario = 123;
Scroll to Top