-
Notifications
You must be signed in to change notification settings - Fork 0
/
voorraad_rapport.php
71 lines (60 loc) · 1.94 KB
/
voorraad_rapport.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
<table border="0" cellspacing="0">
<h1 style="text-align: center;">Voorraad rapport</h1>
<thead>
<tr>
<th>Titel</th>
<th>Artiest</th>
<th>Genre</th>
<th>Prijs</th>
<th>Voorraad</th>
</tr>
<?php
include 'conn.php';
$count = 0;
try {
$sql = "SELECT voorraad FROM album";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$kolommen = $stmt->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
echo $sql . "<br>" . $e->getMessage();
}
$bgcolor = true;
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($row['voorraad'] < 50) {
$count++;
}
}
echo '<p style="text-align: center;">Totaal titels met voorad onder de 50 is ' . $count . '</p>';
?>
</thead>
<tbody>
<?php
include 'conn.php';
try {
$sql = "SELECT * FROM album";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$kolommen = $stmt->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
echo $sql . "<br>" . $e->getMessage();
}
foreach ($kolommen as $value => $key) {
echo "<th><b>" . $value . "</b></th>";
}
$bgcolor = true;
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo ($bgcolor ? "<tr bgcolor='#f2f2f2'>" : "<tr>");
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['titel'] . "</td>";
echo "<td>" . $row['artiest'] . "</td>";
echo "<td>" . $row['genre'] . "</td>";
echo "<td>" . $row['prijs'] . "</td>";
echo "<td>" . $row['voorraad'] . "</td>";
$bgcolor = ($bgcolor ? false : true);
}
?>
</tbody>
</table>