/    Sign up×
Community /Pin to ProfileBookmark

Please help- Making a Cron – should be easy

hello all , for my game for the past month ive been updating the scoreboards by doing this in sqlmyadmin every day as :

[code=php]UPDATE users SET score = units * 1 + time * 100 + weapon3 * 50 + wall * 50 + lab * 80 + image * 2000[/code]

in the sql box in it.

and wounderd how i can make it as a file (.php) so then i can upload it to my web host.

any help will save me hours of my time, thanks a bunch, a very big bunch

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@JickDec 23.2007 — Crons are something you do separate from PHP. It can be different from server to server. On your server you need to make a cron that will call a PHP script which inserts the desired item into the database. I'm not too experienced with crons but perhaps this will get you started.

As for the PHP end of it, something as simple as this should do the trick.[code=php]<?php
mysql_connect('localhost', 'my_database_username', 'my_database_password');
mysql_select_db('my_database_name');
mysql_query('UPDATE users SET score = units * 1 + time * 100 + weapon3 * 50 + wall * 50 + lab * 80 + image * 2000');
?>[/code]
I hope that helps. ?
Copy linkTweet thisAlerts:
@mitchellauthorDec 23.2007 — Thanks a lot Jick ?
Copy linkTweet thisAlerts:
@JickDec 24.2007 — No problem at all. ?
×

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.17,
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,
)...