How to store user money in a database?

What is the best way to keep current user balance in MySQL? I am developing something like Neobux, so every user has balance data in MySQL.

+5
source share
4 answers

I say, keep all transactions, not just the current balance. Thus, you have a story, and you can run different units on it, and not just the "final balance".

+8
source

Use decimal(10,2). floatsusceptible to rounding errors, see here .

For more information, you can take a look at these pages:

+13
0
source

If you just kept the balance, add only the database entry, but if you want to save all transactions, you should get a new table with the username as the referrer of the class, all transactions will automatically notice that if you are not a great programmer it would be difficult to do The type of website you want, so please consider buying a finished one.

0
source

All Articles