}
         }
         $cellmax = $cols[$i] . "" . $num[$j];
         foreach ($sheet1->getMergeCells() as $range) {
             if ($sheet1->getCell($cellmax)->isInRange($range)) {
                 $Subject = $sheet1->getCell($cellmax)->getValue();
                 if (preg_match("/(?i)lab/", $Subject)) {
                     $hasLab = true;
                 }
                 $isMergedCell = true;
                 break;
             } else {
                 $isMergedCell = false;
             }
         }
         get_multiple_values($cellmax, $hasLab, $isMergedCell);
     }
 }
 //insert into database
 $query = "select c1.sem,c1.s_initial,c1.start_time,c1.end_time,c1.day,c2.start_time as start,c2.end_time as end from class as c1,class as c2 where c1.sem=c2.sem and c1.s_initial=c2.s_initial and c1.start_time=c2.end_time and c1.day=c2.day;";
 $result1 = mysqli_query($con, $query);
 if ($result1 === FALSE) {
     ///echo "<font color=green>(".mysqli_error($con).")</font>";
 }
 //combine values in case of seperate hours placed next to each other
 if (isset($result1) and $result1 != FALSE) {
     $num_rows = $result1->num_rows;
     if ($num_rows > 0) {
         while ($row = mysqli_fetch_assoc($result1)) {
             $sem = $row['sem'];
             $sub = $row['s_initial'];
         $ext = pathinfo($fname, PATHINFO_EXTENSION);
         $temp = $sem . "sem_tt" . "." . $ext;
         $lab_true = false;
         $objReader = PHPExcel_IOFactory::createReader($inputFileType);
         $objPHPExcel = $objReader->load("uploads/" . $temp);
         $cellmax = $cols[$i] . "" . $num[$j];
         foreach ($objPHPExcel->setActiveSheetIndex(0)->getMergeCells() as $range) {
             if ($objPHPExcel->setActiveSheetIndex(0)->getCell($cellmax)->isInRange($range)) {
                 $lab_true = true;
                 $first = true;
                 break;
             } else {
                 $first = false;
             }
         }
         get_multiple_values($cellmax, $lab_true, $first);
     }
 }
 //function to upload teacher entries into handles table from second sheet of Excel
 function teacher_uploads($num)
 {
     //set values and get uplaoded file from the stored location in server
     $inputFileType = 'Excel2007';
     $sem = $_POST["sem"];
     $fname = $_FILES['file']['name'];
     $ext = pathinfo($fname, PATHINFO_EXTENSION);
     $temp = $sem . "sem_tt" . "." . $ext;
     $objReader = PHPExcel_IOFactory::createReader($inputFileType);
     $objPHPExcel = $objReader->load("uploads/" . $temp);
     //get subject and teacher values from the file
     $sub = "A" . $num;