php - Reading schedules of employees from an excel sheet -


i'm uploading excel sheet , reading values insert database. inside excel sheet have "id" "name" , log in , log out values days of months 1 till 31.

php code:

function getschedule($filepath,$con,$filename){      require_once '';     $objphpexcel = phpexcel_iofactory::load($filepath);      foreach ($objphpexcel->getworksheetiterator() $worksheet) {                $sql="insert `schedule` (`status`,`lastchange`, `location`,'date','id','name' ) values (";             ($col = 0; $col < $highestcolumnindex; ++ $col) {                 $cell = $worksheet->getcellbycolumnandrow($col, $row);                 $val = $cell->getvalue();                 if($col==5){                      $sql.="'$val'";                 }else{                     $sql.="'$val', ";}             } 

hope got right.

you can allow value "null" on days 29, 30, 31. doing can same query before.

for php have values anyway. , them out of file, means, 29th of february 31th of february "". let php replace "" null , done on job. :)


Comments