$sql="select*from schedule where SUBJECTS_ID='$SUBJECTS_ID' AND PROGRAM='$PROGRAM_NAME' AND LEV='$LEV_NAME' AND YEAR='$YEAR' AND CLASS='$CLASS' AND DAY='$DAY' AND (TIME_1='$TIME_1' OR TIME_2='$TIME_2' OR TIME_3='$TIME_3' OR TIME_4='$TIME_4' OR TIME_5='$TIME_5' OR TIME_6='$TIME_6' OR TIME_7='$TIME_7' OR TIME_8='$TIME_8' OR TIME_9='$TIME_9' OR TIME_10='$TIME_10') ";
$query=mysql_query($sql);
$obj=mysql_fetch_array($query);
if($obj!=0)
{
echo"เวลาเรียนมีการทับกันอยู่ กรุณาลงเวลาใหม่";
exit();
}
else
{
..............สามารถ insert ข้อมูลได้.............
}