2 $result=$db->query("SELECT id,examples,nexamples FROM sessions ORDER BY id");
4 while ($session = $result->fetch(PDO::FETCH_ASSOC)) {
5 $SESSIONS[$session['id']] = array("id" => $session['id'], "timestr" => date("d.m.Y H:i", $session['id']),
6 "workdone" => $db->query("SELECT COUNT(*) FROM workdone WHERE session=" . $session['id'])->fetch(PDO::FETCH_NUM)[0],
7 "examples" => $session['examples'], "nexamples" => $session['nexamples']);
8 if ( strtotime("now") < $session['id'] && ( $SESSIONS_next==-1 || $SESSIONS_next > $session['id'] ) ) {
9 $SESSIONS_next = $session['id'];
12 if($SESSIONS_next == -1) unset($SESSIONS_next);
15 foreach ($SESSIONS as $session) {
16 if($session['id'] < $SESSIONS_next) { $SESSIONS_totex += $session['nexamples']; }