-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopularRoom_report.php
54 lines (48 loc) · 1.27 KB
/
popularRoom_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
<html>
<head>
<title>Popular Room </title>
</head>
<body>
<?php
/**
* Version: 1.0
* Author: Thanh Tran
* Report of popular room category in each location in August
**/
include ('connect.php');
$query = "SELECT RR.Location,RR.Category, MAX( RR.Num ) AS Num
FROM
(
SELECT R.Room_number, R.Location, Room.Category, COUNT( * ) AS Num
FROM
(
SELECT Reservation_has_room.Room_number, Reservation_has_room.Location
FROM Reservation_has_room
NATURAL JOIN Reservation
WHERE MONTH(Reservation.End_date) = '08'
)R
LEFT JOIN Room ON R.Room_number = Room.Room_number
AND R.Location = Room.Location
GROUP BY Location, Category
)RR
GROUP BY Location";
$result = mysql_query($query);
echo "<table border = '5'>";
echo "<tr> <th COLSPAN='4'> Popular Room</th> </tr>";
echo "<tr><th> Month</th><th>Location</th><th>Category</th><th>Num</th></tr>";
echo "<th ROWSPAN='6'>August</th>";
while($row = mysql_fetch_assoc(($result))) {
echo "<tr>";
echo "<td>". $row['Location'] . "</tb>";
echo "<td>". $row['Category'] . "</tb>";
echo "<td>". $row['Num'] . "</tb>";
echo "</tr>";
}
echo "</table>";
mysql_close($db_server);
?>
<form action="management_panel.php">
<input type="submit" value="Back">
</form>
</body>
</html>