I am working with OT system .i want compare two time variable more than 24. first value coming from the following function.
function GetApprovedOt($connect,$emp_id,$passmonth)
{
$query01 ="SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `ot_hour` ) ) ) AS timeSum
FROM otresquest
WHERE em_id = $emp_id AND from_month LIKE '$passmonth%' AND overtime_status=6";
$statement = $connect->prepare($query01);
if($statement->execute())
{
$result = $statement->fetchAll();
foreach($result as $row){
$sum =$row["timeSum"];
return $sum;
}
}
}
i write function to get the time value using following function.
function formatHours($time){
$date = explode(':', $time);
return ($date[0]*60*60)+($date[1]*60)+$date[2];
}
if(formatHours($time_duration_1) > formatHours($time_duration_2)){
my problem is formatHours function working for single value pass in to the function like formatHours($row["ot_hour"]) but i try to pass value of GetApprovedOt($connect,$row["emp_id"],$_GET["month"]) get error like
Notice: Undefined offset: 1 in C:\xampp\htdocs\attendance\admin\report05.php on line 243
Notice: Undefined offset: 2 in C:\xampp\htdocs\attendance\admin\report05.php on line 243
Line 243 is return ($date[0]*60*60)+($date[1]*60)+$date[2]; how do void this error ?how appreciate yours valuable contribution
Aucun commentaire:
Enregistrer un commentaire