I am running out of ideas!
I am pretty new to php and I think I am making it harder than it probably is. Sorry!
I am having difficulty figuring out how to make a countdown timer that will count down from 30 minutes to 0 and then having it continually repeat the countdown by starting over every time it goes to zero. (And actually it does start counting over as it stands, but I know that I am doing incorrectly). Once it reaches 0 I need to do an update to the rest of my page.
I am using this for a project so if I can figure it out for one of the timers I should be able to handle the others.
I have this configured in my functions page and am using an include in another page to call the function.
This one works fine for a one hour update, but can't figure out how to use it for 30 minute update.
This timer is used to update other parts of my project so I don't want to use an event date.
I think my logic has disappeared!! Am I thinking about this incorrectly?
function countdown ($online){
global $time;
$difference=$time-$online;
$num = $difference/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
$num3 = ($num2 - $hours)*60;
$mins = intval($num3);
$num4 = ($num3 - $mins)*60;
$secs = intval($num4);
//if($days != 0){echo"$days days, ";}
//if($hours != 0){echo"$hours hours, ";}
if($mins != 0){echo"$mins mins, ";}
echo"$secs secs";
}
Any suggestions would be wonderful.