Show sourcecode
The following files exists in this folder. Click to view.
access-deneid.png
diagramresultat.php
insert-admin.php
login.php
logout.php
personliga-resultat.php
quiz-sida.php
ransa-quiz-session.php
ransa-skapa-quiz-session.php
resultat.php
session-variabler-unset.php
signin.php
skapa-inloggning-tabell.php
skapa-quiz-tabeller.php
skapa-quiz.php
start.php
tabort-kunder-quiz.php
åtkomst-nekad.php
diagramresultat.php
84 lines UTF-8 Windows (CRLF)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
session_start();
include ('../../dbconnection.php');
?>
<br>
<?php
$antalRättLista = array();
$sql = "SELECT * FROM resultat";
$stmt = $dbconn->prepare($sql);
$stmt->execute();
while ($res = $stmt->fetch(PDO::FETCH_ASSOC)) {
array_push($antalRättLista, $res['antalrätt']);
}
$countValues = array_count_values($antalRättLista);
$värden = [
isset($countValues[5]) ? $countValues[5] : 0,
isset($countValues[4]) ? $countValues[4] : 0,
isset($countValues[3]) ? $countValues[3] : 0,
isset($countValues[2]) ? $countValues[2] : 0,
isset($countValues[1]) ? $countValues[1] : 0,
isset($countValues[0]) ? $countValues[0] : 0
];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
</head>
<body>
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>
<script>
const xValues = ["5", "4", "3", "2", "1", "0"];
const yValues = <?php echo json_encode($värden); ?>;
const barColors = ["#800080", "#6A0DAD", "#571BCE", "#3F3FE0", "#2862F0", "#0080FF"];
new Chart("myChart", {
type: "bar",
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
},
options: {
legend: {display: false},
title: {
display: true,
text: "Antal rätt totalt över alla Quiz"
},
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: "Antal rätt"
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: "Antal tagna Quiz"
},
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
<a href="start.php">Tillbaka till start</a>
</body>
</html>