Jump to content

[SOLVED] php how to add a countdown script till something is updated


Danny620

Recommended Posts

OK heres what i am planing to do

 

i want to build a game where the user logins and he has is own town thing then he clicks on the HQ

and there he can upgrade his buildings by clicking on like "upgrade to level x" then this would start the contruction that's where the countdown comes in say he upgrades to level 2 hes building takes 34Min's to construct that's where i want it to count down 34Min's then run the script that updates the db to say hes level 2.

Link to comment
Share on other sites

Why don't you have a table in your database called construction. When a user clicks 'upgrade to level x' a row is added to the table with the end time (current timestamp plus {60*34} for 34 mins), the users id and a reference to the building. On page load check that table for results, if it's empty nothing is being built, if it has results check the end time against the current time. If it has passed delete the row from the construction table and update the necessary hq level.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.