Ho capito, non ho assegnato la query come variabile. invece ho usato per ciascuno e una funzione getResult.
foreach ($rs as $key => $value) {
$db=new Database();
$db->connect();
$alterin= date('H:i:s', strtotime($value['alterIN']));
$db->select(array('myilogin_46.DATE_TIME_RECORDS'),'SHIFT_START'
,"ID = '".$value['dtrID']."' and R_STATUS='A'");
foreach ($db->getResult() as $key => $value) {
$shiftstart = $value['SHIFT_START'];
}
$late= $alterin - $shiftstart;
// if($shiftstart >= $alterin){
// $late= "00:00:00";
// }elseif ($shiftstart > $alterin) {
// # code...
// $late= $alterin - $shiftstart;
// }
echo $shiftstart;
echo $alterin;
echo $late; //