-
Notifications
You must be signed in to change notification settings - Fork 0
/
jawab_ulangkaji.php
88 lines (82 loc) · 2.34 KB
/
jawab_ulangkaji.php
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
85
86
87
<?php
include('sambungan.php');
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
?>
<link rel="stylesheet" href="senarai.css">
<table>
<caption>SKEMA DAN KEPUTUSAN</caption>
<tr>
<th>Bil</th>
<th>Soalan</th>
<th>Skema</th>
</tr>
<?php
$jumlah = 0;
$betul = 0;
$idpelajar = $_SESSION['username'];
$sql = "select * from kuiz join soalan on kuiz.idsoalan = soalan.idsoalan
where idpelajar = '".$idpelajar."'";
$data = mysqli_query($sambungan, $sql);
$bil = 1;
while ($kuiz = mysqli_fetch_array($data)) {
?>
<tr>
<td class="bil"><?php echo $bil; ?></td>
<td class="soalan">
<?php
echo $kuiz['namasoalan']."<br>";
echo "A.".$kuiz['pilihana']."<br>";
echo "B.".$kuiz['pilihanb']."<br>";
echo "C.".$kuiz['pilihanc']."<br>";
?>
</td>
<td class="skema">
<?php
echo "Jawapannya : ".$kuiz['jawapan']."<br>";
echo "Anda pilih ".$kuiz['pilih']."<br>";
if ( $kuiz['pilih'] == $kuiz['jawapan']) {
echo "<img src='betul.png'>";
$betul = $betul + 1;
}
else
echo "<img src='salah.png'>";
?>
</td>
</tr>
<?php
$bil = $bil + 1;
$jumlah = $jumlah + 1;
}
?>
</table>
<?php
$peratus = $betul / $jumlah * 100;
$salah = $jumlah - $betul;
$sql = "update kuiz set peratus = $peratus where idpelajar = '".$idpelajar."'";
$data = mysqli_query($sambungan, $sql);
?>
<table>
<caption>KEPUTUSAN PRESTASI INDIVIDU</caption>
<tr>
<th class="keputusan">Perkara</th>
<th class="keputusan">Bilangan/Peratus</th>
</tr>
<tr>
<td class="keputusan">Bilangan yang betul</td>
<td class="keputusan"><?php echo $betul ?></td>
</tr>
<tr>
<td class="keputusan">Bilangan yang salah</td>
<td class="keputusan"><?php echo $salah ?></td>
</tr>
<tr>
<td class="keputusan">Jumlah soalan</td>
<td class="keputusan"><?php echo $jumlah ?></td>
</tr>
<tr>
<td class="keputusan">Keputusan</td>
<td class="keputusan"><?php echo number_format($peratus,0) ?> % </td>
</tr>
</table>