Sign in to follow this  
Hernanduer

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this