0

We need to update 2 parameters in one row from DB: actInTime and the stat.

Based on the current time the status can be 'Working(L)' or 'Working'.

stat is DB is defined as an ENUM with 'Working(L)' and 'Working' as the values.

$shiftData = ShiftDetails::model()->findByPk($shift["shiftID"]);
if(($curentTime - strtotime($shiftData->planInTime)) > 600) {
    $shiftData->stat = 'Working(L)';
}
else {
    $shiftData->stat = 'Working';
}
$shiftData->actInTime = Yii::app()->Date->now();
$shiftData->save();

The issue we face is not repeatable. Some time both actInTime and stat is getting updated, but some times stat is not. actInTime is updating always without any issues

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
user2050274
  • 41
  • 1
  • 2
  • 4
  • we tried with changing into VARCHAR. Still the issue exists. :( Also the time Zones are same. – user2050274 Apr 02 '14 at 08:47
  • based on time that IF statement is functioning properly. i tried to put LOG there also am getting the proper stat values. but its not updating into server. – user2050274 Apr 02 '14 at 09:17

0 Answers0