
Originally Posted by
EliteGM
Read the other posts its offline,
@fook3d:
If I have them in that one table it saves alot of time though..
Would still be in 1 table, just 1 row instead of 28.
----------
Easiest way I can explain it in a code it when I was using timestamps to update user accounts in a game code I was writing, by using arrays to store timestamps.
The user row was "times" and held a value like "123456,234567,345678"
Was then called something like:
PHP Code:
function energyUpdate()
{
global $c, $user;
// Pull the data and put it into an array
$data_array = array($user['times']);
// Loop from the 2nd part of the array which was the energy time (Remember arrays start at 0, not 1)
$x = data_array[1];
while($x < time())
{
$x = $x + 300; // Cron was 5 minutes, so 60 seconds * 5 minutes = 300 seconds.
mysql_query("UPDATE `usr` SET `en` = `en` + (en/10) WHERE `usr_id` = " . $user['usr_id']);
}
// Loops finished.. So update the array
$data_array[1] = $x;
mysql_query("UPDATE `usr` SET `times` = '$data_array' WHERE `usr_id` = " . $user['usr_id']);
}
Note I just wrote the above function, not the one i actually used (Don't have it anymore as i scrapped the project) so it possibly don't work, but providing a working script wasn't my point, trying to explain how they can be used was
There has to be a way that you can put all the whore's into an array to save the script loading 28 rows instead of 1.
Hope this post at least helps you out a little. If you want me to help you understand it more, give me a shout through PM, but I can't say how long a reply would take should you take up the offer (No internet at home, only have access when visitting family, which is not as bad as it sounds, amazing how much work i get done locally without having the internet connection distracting me :laugh_1: