Sorry to bump this but can anyone help me out?
The time values are in mysql db as time type. Here's my code...
/***********************
declare variables
***********************/
$course = $_POST['course'];
$location = $_POST['location'];
$booked_by = $_POST['booked_by'];
$note = $_POST['note'];
$date1 = $_POST['date1xx'];
// time start
$hr_start = $_POST['hour'];
$min_start = $_POST['minute'];
// time end
$hr_end = $_POST['hr_end'];
$min_end = $_POST['min_end'];
// connect to db
include('../db_connect.php');
// process date
list($day, $month, $year) = split('[/.-]', $date1);
echo "Day: $day; Month: $month; Year: $year<br />\n";
$meeting_date = $year.'-'.$month.'-'.$day;
echo $meeting_date;
echo '<br /><br />';
// process time
$time_start = $hr_start.':'.$min_start;
echo $time_start.'<br />';
$time_end = $hr_end.':'.$min_end;
echo $time_end.'<br />';
/************************
Check against Classes
************************/
$query = "SELECT location_ID, class_date, time_start, time_end ".
"FROM class ".
"WHERE location_ID = '$location' ".
"AND class_date = '$meeting_date'";
echo '<br /><br />'.$query.'<br /><br />';
$result = mysql_query($query) or die(mysql_error());
$num_results = mysql_num_rows($result);
echo 'Num_Results: '.$num_results.'<br /><br />';
if ($num_results >0)
{
// check class times
while($row = mysql_fetch_array($result))
{
$class_start = $row['time_start'];
$class_end = $row['time_end'];
echo 'CLASS TIME: '.$class_start.':::'.$class_end.'<br /><br />';
if(($time_start >= $class_start) && ($time_start < $class_end))
{
echo 'a.Time Taken<br />';
}
if(($time_end > $class_start) && ($time_end <= $class_end))
{
echo 'Time Taken';
}
}
echo '<br />Booked Out';
exit;
} // end if($num_results)
[/code]