Hi All
Im adding a slot system into our business and are having a few issues with the times. It works with two loops one for the hour and one for the minutes.
Each slot has a duration ie 45 mins the system starts the hour and minute count looks up in the database see if that time is availble and applies a time lot of 20 mins to it. The counted adds on the 45 mins and does the same thing again until it hits the 60 mins then jumps back to the hour loop and add on the times
ie 9:00 slot
9:45 slot
10: 30 slot
11:15 slot and so on.

Code works ok but times can be off by a minute or so when you pass through an hour. Any help would be great

Thanks Steve

Code....
$clientID = 123;
$hourStart = 9;
$hourFinish = 16;
$duration = 25;
$slotDuration = $duration;
$slotsPerHour = 60/$slotDuration;



for($h=$hourStart; $h<=$hourFinish; $h++)
{

echo("Hour:$h<br>");

if($minsLeft!="")
{
$mins = "$minsLeft";
}
else
{
$mins=0;
}

for($m=$mins; $m<60; $m++)
{
//echo("Minute:$m<br>");
$minutes = $m;
$timeStamp = "25 Apr 2012 $h:$minutes GMT";
$unix = strtotime($timeStamp);


$query = "SELECT id, slotStatus FROM tblTimeSlots WHERE slotTime>='$unix'";

$result = mysql_query($query,$db);
$row = mysql_fetch_array($result);
$slotStatus = $row[slotStatus];
$id = $row[id];

if($slotStatus=="AVAILABLE")
{
$timeStamp = "25/4/2012 $h:$m GMT";
echo("$id :AVAILABLE $timeStamp<br>");

$m+=$duration-1;
//echo("Minute:$m<br>");
if($m>59)
{
$minsLeft = $m - 60;
}
}
else
{
echo("$id :BOOKED $timeStamp<br>");
$m+=$duration-1;


}





}
}