-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsch.php
More file actions
105 lines (69 loc) · 2.42 KB
/
Copy pathsch.php
File metadata and controls
105 lines (69 loc) · 2.42 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
header("Content-Type: text/html; charset=UTF-8");
$db_name="threepig";
//parse_str( html_entity_decode( $_SERVER['QUERY_STRING']) , $out);
$connect=mysqli_connect("localhost","threepig","sungshin95",$db_name);
if (mysqli_connect_errno()){
echo"error:".mysqli_connect_error();
exit;
}
$numIn=$_GET["numIn"];
$numOut=$_GET["numOut"];
$cafeID=$_GET["cafeID"];
$uid=$_GET["uid"];
$s="INSERT INTO ESPtable(numIn,numOut,cafeID,uid) VALUES($numIn,$numOut,$cafeID,$uid)";
$sResult=mysqli_query($connect,$s);
$n=$_POST['name'];
//$edit="SELECT cafeName,numTable,numChair,numIn,numOut FROM cafeInfo as ci join ESPtable as et ON ci.cafeID=et.cafeID where name LIKE '%$n%' ORDER BY uid desc limit 1";
$edit = "select DISTINCT t3.cafeName,t3.numTable,t3.cafeID,t3.numChair,numIn,numOut from cafeInfo as t3 join (select t1.cafeID, t1.uid, t1.numIn, t1.numOut from ESPtable as t1,(select cafeID, max(uid) as max_uid from ESPtable group by cafeID ) as t2 where t1.uid=t2.max_uid and t1.cafeID=t2.cafeID) as t4 on t3.cafeID=t4.cafeID where t3.name LIKE '%$n%' ORDER BY t3.cafeID ";
$sql="select * from ESPtable";
$result=mysqli_query($connect,$edit);
$ard=mysqli_query($connect,$sql);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>앉는 카페</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link type="text/css" rel="stylesheet" href="homeStyle.css">
</head>
<body>
<nav class="row">
<img id="miniLogo" class="col-3 col-s-3" src="Logo.png">
<ul>
<li class="col-1 col-s-1 tomain"><a href="/index.php">첫화면으로</a></li>
</ul>
</nav>
<section>
<table class="center">
<tr>
<th>카페이름</th>
<th>혼잡도</th>
<th>실시간 인원</th>
<th>테이블 수</th>
<th>의자 수</th>
</tr>
<?php
while($row = mysqli_fetch_array($result)){
$totalPeople=$row['numIn']-$row['numOut'];
if($totalPeople<0) $totalPeople=0;
$per=$totalPeople/$row['numChair'];
if($per>=0.9) $perName="만석";
else if($per>=0.6&&$per<0.8) $perName="혼잡";
else if($per>=0.4&&$per<0.6) $perName="보통";
else $perName="여유";
echo "<tr>";
echo "<td>" . $row['cafeName'] . "</td>";
echo "<td>" . $perName . "</td>";
echo "<td>" . $totalPeople . "</td>";
echo "<td>" . $row['numTable'] . "</td>";
echo "<td>" . $row['numChair'] . "</td>";
echo "</tr>";
$n++;
}
?>
</table>
</section>
</body>
</html>