Okay. That's very interesting. Here's what I'm gonna say we try first:
-- What is the value in the database of $depart and $Arrive? If they are dates like mm/dd/yy H:i:s then you should use mktime() to do the calculations. If they are stored as 195814012485 then you are fine.
-- If the latter of the previous statement is correct, then you should change your strtotime syntax to: strtotime("+20 minutes", $gotodepartures)
Finally, add some date info in with the times. This way, you know what day(s) you're playing with. THe problem I see is that my time (19:21:36) doesn't fall between any of the flight times.
Try this first!!
Okay, since you dont' show how you're calling the function, I'm not 100% sure this will work, but it might. Try changing your function so that you include the variables from outside of it, AND the time passed to it is the current time of that person:
function chooseImage($timenow){
global $checkin, $gotodepartures, $gotogate, $boarding;
global $lastcall, $depart, $Arrive, $finished;
if($timenow < $checkin) $img = lights_off;
else if ($timenow >= $checkin && $timenow < $gotodepartures) $img = 1;
else if ($timenow >= $gotodepartures && $timenow < $gototogate) $img = 2;
else if ($timenow >= $gotogate && $timenow < $boarding) $img = 3;
else if ($timenow >= $boarding && $timenow < $lastcall) $img = 4;
else if ($timenow >= $lastcall && $timenow < $depart) $img = 5;
else if ($timenow >= $depart && $timenow < $Arrive) $img = 6;
else if ($timenow >= $Arrive) $img = 7;
else if ($timenow >= $finished) $img = 8;
return '<img src="'.$img.'.gif" width="27" height="11">';
}
I would also like to point out that you forgot a "$" in this script in front of depart.
Also, your last elseif() statements need cleaning up. If the finished time is always later than the arrival time, you'll never display finished with what you currently have. You need to change the arrive line to add a less than $finished part (like the others).
~Brett