query("SELECT * FROM tourenliste WHERE time>'".$kontrollzeit."' and time<'".$auslesezeit."' ORDER BY time"); $key=0; while($row = $laufend->fetch_assoc()) { $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $row_fahrer = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'"); $kartenlog = $GLOBALS['mysql']->query_single("SELECT * FROM kartenlog WHERE user='".$row['fahrer']."' ORDER BY zeit DESC LIMIT 0,1"); if($kartenlog['zeit']<$kontrollzeit) { $diff=$row['time']-$a_zeit; $gelbzeit=$row['time']-3600; if($gelbzeit<$a_zeit) { $ntour1[$key]['tour']=$row_tour['tour']; $ntour1[$key]['name']=$row_fahrer['name']; $ntour1[$key]['diff']=$diff; } else { $ntour2[$key]['tour']=$row_tour['tour']; $ntour2[$key]['name']=$row_fahrer['name']; $ntour2[$key]['diff']=$diff; } } $key++; } $template->assign('ntour1', $ntour1); $template->assign('ntour2', $ntour2); $template->assign('content', 'tpl/ajax/n_tour.tpl');