Answer the question
In order to leave comments, you need to log in
How to make a countdown timer with time from the database + Node JS?
Hello, how to make a node js time countdown from the database?
I need to do this, when you click on the Free Coins button, the time is recorded in the database, and while it is more than 0 , the
player will not be able to take coins until the time is 0
, so the question is, how to do this correctly on Node js?
how to select a number from the database?
pool.query(
"UPDATE `account` SET `freeCoins`= freeCoins -1",
function(err, rows) {
}
);
Answer the question
In order to leave comments, you need to log in
When you click on the button, you must put the current timestamp into the base.
Next, check with this timestamp, calculating the timestamp of the new opportunity to click on the button.
UPDATE `account` SET `freeCoins`= NOW()
But it's better to generate a timestamp on the node side and put it in the base already.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question