0

I am new to php. In my code, I need to decrement an array value to get the desired output. But when I do so, I get a maximum execution time exceeded error - here is part of my code:

    $columnStart='B';
    $columnOffset=$noOfExams;
    $rowStart=2;
    $rowOffset=count($staffArray);

    for($i=0;$i<$columnOffset;$i++)
    {
            $dutyCount=$DutiesPerDay;
            while ($dutyCount>0) {
                    # code...
                    $rnum=rand($rowStart,$rowStart+$rowOffset-1);
                    $cellValue=$objPhpExcel->getActiveSheet()->getCell($columnStart.$rnum)->getValue();
                    if(is_null($cellValue)||$cellValue=="")
                    {
                            $staffName=$objPhpExcel->getActiveSheet()->getCell('A'.$rnum)->getValue();
                            if($dutyArray[$staffName]>0)
                            {
                                    $objPhpExcel->getActiveSheet()->setCellValue($columnStart.$rnum,"Yes");
                                    $dutyArray[$staffName];
                                    $dutyCount--;
                            }

                    }
            }
            $columnStart++;
            //echo $columnStart."<br>";
    }

Full code here: http://pastebin.com/fx5aVxUH (sorry for the messy code). The error is in line 123. I cannot decrement the value of that variable.Everything else is fine. Can somebody please help me. I already tried this link and it didnt help. PHP Fatal Error: Maximum execution time exceeded

Community
  • 1
  • 1

0 Answers0