/    Sign up×
Community /Pin to ProfileBookmark

PHP Timed Stuff help

is there any way i can make this timed on a server when clicking it, so when i click the “build” it (shows a timer would be great) and takes 1 hour before the quest is carryed out on the server, i hope this still carrys out even when a user has logged out/ goes to other pages.

[code=php]mysql_query(“UPDATE users SET money=money-‘$train_money’, units=units+’$train_s’ WHERE id=’$user[id]'”);[/code]

any help will be very happy, ive read so much about time() but it doesnt talk about sceduling something on a server etc.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@mitchellauthorNov 20.2007 — im happy with anything you can say, anything
Copy linkTweet thisAlerts:
@gpm1982Nov 20.2007 — hmm you can either use cronjob or write a script and then run as background process
Copy linkTweet thisAlerts:
@mitchellauthorNov 20.2007 — does anyone know how i can run a timed background process on a server
Copy linkTweet thisAlerts:
@spliffNov 20.2007 — cronjob should do the trick
Copy linkTweet thisAlerts:
@mitchellauthorNov 20.2007 — can someone tell me how to do it so when a user clicks a button it is loged and then at the required time it updates the required feild?
Copy linkTweet thisAlerts:
@TheRaveNov 21.2007 — The best way would be to create a standing cron job as the others have said.

Setting up a cron job depends on your host. For example if you have cPanel hosting there is a section under "cron". (I suggest you google "cron" for more information).

The standing cron job can then be set to executate every 5-15mins and depending on timestamps execute the SQL query.
×

Success!

Help @mitchell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...