That’s obviously not right, you would obviously update the database when the money changes and then send that to the client to keep a local copy. But what you’re suggesting would work for maybe one or to variables, but if you had 100 that needed to be kept up-to-date, the database is your “Data Base”. Keep the info there, and retrieve it when needed. Otherwise you’re doubling the data locations.
I’m just saying, if I stored data in a database, I would never store it in two places at once. It’s just not needed, and, as I said, clunky. Database queries are built to be ran often and can retrieve large amounts of data quickly from multiple sources.
My post above with the query function and callback command is, in my opinion, the best way to do it. I wouldn’t store the data twice in this scenario. If you store it twice, you have to keep two locations up-to-date and this opens up the risk of inconsistent data.
And like I said, if an external source needed to update it, you’d have to, as you said, tell the database to get the new value, which is again just clunky. The database is your central data storage location, if all sources pull from there when needed, you don’t have to have other messages flying around telling locations to pull down the new data, just pull it down when you need it and it’ll always be the most up-to-date.
Notice how I ‘disagree’ with you, rather then calling you dumb. It’s called maturity.