this is what I have done so far!
how do I key the array?
PHP Code:
$sql = "SELECT * FROM tblSchedule, tblfilms WHERE tblSchedule.FilmiID = tblfilms.FilmID AND tblSchedule.Day='$strWeekday' ORDER Starttime";
$sql_result = mysql_query($sql);
while ($row = mysql_fetch_array($sql_result)) {
$test[] = $row;
}
foreach ($test as $tests)
{
// HMS_to_seconds - function to convert Hours minutes seconds to integers
if ($tests['Starttime']=="00:00:00")
{$duration_sec = HMS_to_seconds(date("H:i:s", strtotime($test[0]['Endtime'])));}
elseif ($tests['Starttime']<>"00:00:00" AND $tests['Endtime']<"23:59:59")
{$duration_sec = $tests['Duration'];}
else
{$duration_sec = $tests['Duration'];}
$end_sec = $start_sec+$duration_sec;
//seconds_to_HMS - function to convert integer back to hours minutes seconds
$start_HMS = seconds_to_HMS($start_sec);
$duration_HMS = seconds_to_HMS($duration_sec);
$end_HMS = seconds_to_HMS($end_sec);
$start_sec = $end_sec+1 ;
echo $start_HMS ."+". $duration_HMS ."=". $end_HMS ."<br>";
}
Bookmarks