This is to update the timer in my DB and let the user know how much time they have left in the hospital in a game.
Is there a way to make this more accurate? For some reason once in a while the timer is getting stuck and not telling people the time is counting down.
please help!
Code:
$thetime = time();
$result2 = mysql_query("UPDATE `updates` SET `lastdone` = '".$thetime."' WHERE `name` = 'hospital'");
$leftovertime = $timesinceupdate - (floor($timesinceupdate / 60) * 60);
if ($leftovertime>0) {
$newupdate = time() - $leftovertime;
$setleftovertime = mysql_query("UPDATE `updates` SET `lastdone` = '".$newupdate."' WHERE `name` = 'hospital'");
}
|