-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconnections.php
More file actions
70 lines (41 loc) · 1.03 KB
/
connections.php
File metadata and controls
70 lines (41 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once("connection.php");
require_once("function.php");
$query = $db_server->query("SELECT studentid,timestamp,statusid FROM events WHERE statusid = 2");
$qresult = array();
while ($result = $query->fetch_array()) {
array_push($qresult, $result);
}
/*
//$currevent = $qresult[0]["timestamp"];
$studentevents = array();
foreach ($qresult as $event) {
array_push($studentevents,$event);
}
print_r($studentevents);
for ($i = 1; $i < count($qresult); $i++) {
if ($qresult[$i]["timestamp"] == $qresult[$i - 1]["timestamp"]) {
}
}
*/
$ts = $qresult[0]["timestamp"];
for ($i = 1; $i < count($qresult); $i++) {
if ($qresult[$i]['statusid'] == 2) {
foreach(lookfor($qresult[$i]["timestamp"]) as $sub) {
echo $sub . "<br />";
}
}
}
function lookfor($ts) {
global $qresult;
global $connarray;
$toreturn = array();
foreach($qresult as $event) {
if ($event["timestamp"] == $ts) {
array_push($toreturn, idToName($event["studentid"]));
}
}
array_push($toreturn, $ts);
return $toreturn;
}
?>