A Turn-Timer

Started by
2 comments, last by Ravuya 16 years, 10 months ago
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?
-------------------------"Feel the Matrix"
Advertisement
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.
$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.
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.

This topic is closed to new replies.

Advertisement