mysql - Increment PHP variable after x time -
i want make site online currency increments every hour, or other time frame. it's going retrieved mysql database, no matter if user online or not, , amount going added variable , sent server again.
i've looked around still struggling head around explanations.
any appreciated.
thanks in advance!
to reduce constant database updates large number of users, keep track of user's creation time , calculate amount of currency should have there. have have modifier additional spent/stolen/earned money.
example:
user1 created on 1376936553 (the time unix timestamp)
an hour now, unix time 1376940153. if want find out how many possible units of currency should have be
(currenttime - start time)/3600 = 1
then, if user spends one, keep track of in seperate database field , apply total.
Comments
Post a Comment