[PHP] game in php

2003-09-07 Thread phpu
Hello,
I wanna create an online game in php and mysql and I have a problem. I have this 
database with this fields; id and number_attacks. And every 10 minutes number_attack 
to be increased by 1. How can i do that?

Thanks



Re: [PHP] game in php

2003-09-07 Thread Jon Haworth
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



RE: [PHP] game in php

2003-09-07 Thread mek2600-php
*This message was transferred with a trial version of CommuniGate(tm) Pro*
Or, if you only want the number_attacks to increase for every 10 minutes
that someone's playing (so it's not increasing throughout the night)
you'll probably just want to hold the time the game started in a
variable (or DB whatever) and just check with each page refresh to see
if it's time to increase the value.

There's other ways to do it, but your question was kinda vague so I'm
not sure what method would work best for ya.

Michael Kennedy
www.onionology.com

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

*This message was transferred with a trial version of CommuniGate(tm)
Pro*
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



RE: [PHP] game in php

2003-09-07 Thread Mike Brum
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