-
Notifications
You must be signed in to change notification settings - Fork 0
/
category.php
212 lines (190 loc) · 7.38 KB
/
category.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
ini_set('display_errors', '0');
$mysql_host = "localhost";
$mysql_user="hoppydream";
$mysql_passwd="xTGRThJqGgFJ2fNh";
$mysql_db="hoppydream";
$conn = mysqli_connect($mysql_host, $mysql_user,$mysql_passwd,$mysql_db);
mysqli_set_charset($conn,"utf8");
if(!$conn){
die("연결 실패 : ".mysqli_connect_error());
}
?>
<script> console.log('연결성공')</script>
<!--db연결 ------------------------------------------------------------------------------------------->
<?php
$get_location = $_POST['location'];
if($get_location==NULL){
$get_location="";
}
$get_kind = $_POST['kind'];
if($get_kind==NULL){
$get_kind="";
}
$sql = "SELECT * FROM info WHERE address like('$get_location%%') and kind like('$get_kind%%')";
$result = $conn->query($sql);
$resultloc = $conn->query("SELECT distinct left(address, 4) from info;");?>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/category.css">
<!-- CSS only -->
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
crossorigin="anonymous">
<!-- JS, Popper.js, and jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
<style>
.fade:not(.show) {
opacity: inherit;
}
.prev,
.next {
cursor: pointer;
/* position: absolute; */
/* top: 40%; */
width: auto;
/* padding: 16px; */
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
/* border-radius: 3px 3px 3px 3px; */
user-select: none;
margin: 0 10%;
display: inline-block;
}
.prev:hover,
.next:hover {
background-color: rgba(0, 0, 0, 0.0);
color: white;
}
.bootdiv .mySlides {
padding-left: 5%;
padding-right: 5%;
}
a:not([href]) {
color: #6e9758;
text-decoration: none;
}
</style>
<link rel="stylesheet" href="css/test.css">
</head>
<div class = "prevnext"style = "width : 100%;text-align : left; margin-bottom: 15px;">
<form action = "categorytest.php"method = "post">
<select name="location" class="country">
<option value=""disabled selected>지역</option>
<option value="">전체</option>
<option value="강남구">강남구</option>
<option value="강동구">강동구</option>
<option value="강북구">강북구</option>
<option value="강서구">강서구</option>
<option value="관악구">관악구</option>
<option value="광진구">광진구</option>
<option value="구로구">구로구</option>
<option value="금천구">금천구</option>
<option value="노원구">노원구</option>
<option value="도봉구">도봉구</option>
<option value="동대문구">동대문구</option>
<option value="동작구">동작구</option>
<option value="마포구">마포구</option>
<option value="서대문구">서대문구</option>
<option value="서초구">서초구</option>
<option value="성동구">성동구</option>
<option value="성북구">성북구</option>
<option value="송파구">송파구</option>
<option value="양천구">양천구</option>
<option value="영등포구">영등포구</option>
<option value="용산구">용산구</option>
<option value="은평구">은평구</option>
<option value="종로구">종로구</option>
<option value="중구">중구</option>
<option value="중랑구">중랑구</option>
</select>
<select name="kind" class="sector" style = "margin-left : 4px;">
<option value=""disabled selected>업종</option>
<option value="">전체</option>
<option value="한식">한식</option>
<option value="중식">중식</option>
<option value="일식">일식</option>
<option value="양식">양식</option>
<option value="제과점">제과점</option>
<option value="도시락">도시락</option>
<option value="기타">기타</option>
</select>
<input type = "submit" value = "검색"class = "catebtn">
</form>
<a class="prev" style ="margin-top: 7px;"onclick="plusSlides(-1)">❮</a> <a class="next"
onclick="plusSlides(1)" style ="margin-top: 7px;">❯</a>
</div>
<div class="cardcontainer">
<div class="slideshow-container">
<div class="mySlides fade">
<?php
$cntcnt=0;
echo "<script>console.log('$cntcnt');</script>";
if (mysqli_num_rows($result) > 0) {
$cnt = 1;
while($row = $result->fetch_assoc()) {
if($cnt%2==1){
echo "<div class = 'col-lg-5 col-md-6 catecard'>";
echo "<span class = 'catetitle'>" . $row["name"]. "</span><br><span class = 'cateaddress'>" . $row["address"]. "</span><br><span class = 'catekind'>" . $row["kind"]."</span><br><span class = 'catecall'>" . $row["calll"]. "</span>";
echo"</div>";
}
if($cnt%2==0){
echo "<div class = 'col-md-6 col-lg-5 catecard'style = 'float:right;'>";#col-lg-offset-1
echo "<span class = 'catetitle'>" . $row["name"]. "</span><br><span class = 'cateaddress'>" . $row["address"]. "</span><br><span class = 'catekind'>" . $row["kind"]."</span><br><span class = 'catecall'>" . $row["calll"]. "</span>";
echo"</div>";
}
$cnt++; $cntcnt+=1;
echo "<script>console.log('$cntcnt');</script>";
if($cntcnt==6){
$cntcnt=0;?>
</div><!--mysledes fade-->
<div class="mySlides fade">
<?php
}
}
}
else {
echo "아직 조사중입니다! 조금만 기다려주세요!<br>";
echo "현재 검색 가능한 지역 : ";
while($row = $resultloc->fetch_assoc()) {
echo $row['left(address, 4)'];
}
}
?>
</div><!--mysledes fade-->
</div><!--slidshow-container-->
<script>
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i <slides.length; i++) {
slides[i].style.display = "none";
}
slides[slideIndex-1].style.display = "block";
}
</script>
</div><!--cardcontainer-->