Another way you can do it if you don't have that much access to the machine
is to record the last time it was updated and when someone loads the page,
you take the amount of time between the last incriment and now(). 

You then find out how many sets of 10 minutes have passed and incriment it
that many times (if it's less than 10 minutes, you'll be incrimenting zero
times).

The only problem with this is that if 100 people load the script in a 10
minute period, only one will be updating the database - the other 99 are
wasted traffic on the DB.

But if you have no other options...

-----Original Message-----
From: Jon Haworth [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 07, 2003 6:10 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] game in php


Hi,

> I have this database with this fields; id and
> number_attacks. And every 10 minutes
> number_attack to be increased by 1.

You'll need to set up some sort of scheduled task (if you're on unix, your
best bet is probably cron) - this task should call a script that connects to
your database and updates the field. If you like, you can write the script
in PHP and use something like lynx or wget to access it.

Cheers
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to