-
Notifications
You must be signed in to change notification settings - Fork 71
/
user-report.php
68 lines (55 loc) · 1.94 KB
/
user-report.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="sk" lang="sk">
<head><title>Report</title>
<meta http-equiv="Expire" content="now" />
<meta http-equiv="Pragma" content="no-cache" />
<meta name="description" content="DATANEST na mape"/>
<meta name="copyright" content="Copyright (c) 2011 Michal Maly"/>
<meta name="author" content="Michal Maly"/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<h2>Report uzivatelov</h2>
<?php
error_reporting(-1);
require_once 'vendor/autoload.php';
require_once "common.php";
function report()
{
global $db;
if (
$result = $db->query(
"SELECT users.userId,userName,mail,number,privileges,userLimit,credit,count(bikeNum) as currently_rented
from users left join limits on users.userId=limits.userId
left join bikes on users.userId=bikes.currentUser
left join credit on users.userId=credit.userId
group by userId order by userId "
)
) {
echo '<table style="width:100%">';
# echo '<caption>uzivatelia</caption>';
echo "<tr>";
$cols = array("userId", "userName", "mail", "number", "privileges", "userLimit", "credit", "currently_rented");
foreach ($cols as $col) {
echo "<th>$col</th>";
}
echo "</tr>";
while ($row = $result->fetchAssoc()) {
echo "<tr>";
foreach ($cols as $col) {
echo "<td>";
echo $row[$col];
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
} else {
echo "problem s sql dotazom";
die("users bikes not fetched");
}
}
report();
?>
</body></html>