A Turn-Timer

Recommended Posts

ok, heres the deal. I'm creating an online strategy that is based around turns. Turns are processed every 30-sec but I cant figure out how to get PHP to update ALL of the profiles at once. Can someone help me with a way to get the script to update all the profiles at once and not just one?

Share on other sites
Well, I don't know PHP, but whenever I need something to process everything, I just make sure they're all in a data structure of some type (linked list, for example), and have it go through them. A linked list would probably work for this, it should give you enough power to manipulate each player sufficiently, and gives you an easy way to run through every one. Since there won't ( I assume) be many players, the inefficiency of searching through it should be insugnificant. Not sure if this is what you need/if it will work for what you're doing, just my way of doing things.

Share on other sites
$result = mysql_query("SELECT * FROM profiles");while ($row = mysql_fetch_assoc($result)){ // your data is in an array in$row    mysql_query("UPDATE profiles SET junk = 'data', morejunk = 'more data' WHERE id = '" . \$row['id'] . "'");}

Assuming you're using mysql and your game is setup the way I think it is. You're not giving me much to go on.

Share on other sites
You might have to use a cron job or run a central server script with a thread that ticks through, locks the database, and updates the timer data.

Create an account

Register a new account

• Forum Statistics

• Total Topics
627757
• Total Posts
2978950

• 11
• 10
• 10
• 23
• 14