P
P
pemi2017-07-13 14:19:32
PHP
pemi, 2017-07-13 14:19:32

What is the best way to achieve balance?

I am making a website for a game. Players donate. What is the best way to keep balance? Create a table for storing payments (replenishment of write-offs) and calculate the balance by adding transactions? Or just create a balance column and that's it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-07-13
@pemi

Create a table for storing payments (replenishment of write-offs) and calculate the balance by adding transactions? Or just create a balance column and that's it?

Both. The balance column for quickly getting this information, for example, to display it on the profile page. But for any operation with the balance, this column is recalculated by addition. Also, you should not use it when determining whether the user has enough for some operation or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question