I have a PHP code and it work my only problem is if i create a schedule that overlaps the previous schedule
for example i schedule
**7:00 am to 8:30 am ** Succesfully Added
**6:30am to 7:30am ** Error Message: The schedule is conflict with other schedules
**6:30 am to 9:00 am ** Successfully Added (this one overlap a schedule so this needs to be a error)
**7:30am to 9:30am ** Error Message: The schedule is conflict with other schedules
This is the sample of my code
$d_start = strtotime($datetime_start);
$d_end = strtotime($datetime_end);
$roomID = $assembly_hall_id;
$chk = $this->conn->query("SELECT * FROM `schedule_list` where (('{$d_start}'
Between unix_timestamp(datetime_start) and unix_timestamp(datetime_end)) or ('{$d_end}'
Between unix_timestamp(datetime_start) and unix_timestamp(datetime_end))) ".(($roomID > 0) ? "
and assembly_hall_id ='{$roomID}' and sched_status = '1' " : ""))->num_rows;
if($chk > 0 ){
$resp['status'] = 'failed';
$resp['err_msg'] = "The schedule is conflict with other schedules.";
}elseif(strtotime($datetime_start) == null)
{
$resp['status'] = 'failed';
$resp['err_msg'] = "Date and Time Schedule is Invalid.";
}