I am using PHPExcelReader to read an Excel sheet. Here is my code.
<?php
error_reporting(E_ALL ^ E_NOTICE);
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . 'libs/Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
function sheetData($Logg, $empID, $DID) {
$Logg->WriteLog('*************************Starting to validate DID number*************************');
$Logg->WriteLog('Params->EmployeeID: '.$empID);
$Logg->WriteLog('Params->DID: '.$DID);
$inputFileName = '/apps/web/htdocs/Database_all.xlsx'; // File to read
$Logg->WriteLog('inputFileName: '.$inputFileName);
try {
$Logg->WriteLog('inside try');
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$Logg->WriteLog($objPHPExcel);
} catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
$Logg->WriteLog('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$isDIDMatched=false;
$x = 2;
while($x <= sizeof($sheetData)) {
$Logg->WriteLog('Inside loop');
$employee_id = isset($sheetData[$x]['A']) ? $sheetData[$x]['A'] : '';
if (strcmp($employee_id, $empID)==0) {
$Logg->WriteLog('Inside IF');
$DID_num = isset($sheetData[$x]['D']) ? $sheetData[$x]['D'] : '';
if (strcmp($DID, $DID_num)==0) {
$Logg->WriteLog('From excel->EmployeeID: '.$employee_id);
$Logg->WriteLog('From excel->DID number: '.$DID_num);
$Logg->WriteLog('DID number matched');
$isDIDMatched=true;
break;
}
}
$x++;
}
$Logg->WriteLog('*************************End validating DID number*************************');
return $isDIDMatched;
}
?>
This code works until following line.
$Logg->WriteLog('inside try');
It prints 'inside try' and nothing happens after that. There is no any exception or error message. Here is my log.
[2015-05-05 20:52:14] *************************Starting to validate DID number*************************
[2015-05-05 20:52:14] Params->EmployeeID: 2579
[2015-05-05 20:52:14] Params->DID: 7790000658
[2015-05-05 20:52:14] inputFileName: /apps/web/htdocs/Database_all.xlsx
[2015-05-05 20:52:14] inside try
I am using PHP version 5.3.28
Any suggestions would be appreciated.
Thank You