-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewhouse.php
More file actions
248 lines (208 loc) · 6.57 KB
/
viewhouse.php
File metadata and controls
248 lines (208 loc) · 6.57 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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?php
require_once('startsession.php');
require_once('db/connect.php');
$pageTitle = "Sarf Project Homepage";
require_once('components/header.php');
?>
<nav class="mb-1 navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="index.php">Fuostay</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent-4"
aria-controls="navbarSupportedContent-4" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent-4">
<ul class="navbar-nav ml-auto">
<li class="nav-item ">
<a class="nav-link" href="houses.php">
Find house
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="roommates.php">
Find roommate</a>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php">
Log in</a>
</li>
<li class="nav-item">
<a class="nav-link" href="signup.php">
Sign up</a>
</li>
</ul>
</div>
</nav>
<!--/.Navbar -->
</section>
<div class="container-fluid">
<div class="row view-container">
<div class="col-md-7">
<?php
if (isset($_GET['view'])) {
$id = $_GET['view'];
}
$sql = "SELECT * FROM listings WHERE id = '$id'";
$res = mysqli_query($conn, $sql) or die(mysqli_error($conn));
if (mysqli_num_rows($res) == 1){
$row = mysqli_fetch_array($res);
$pictures = explode(',', $row['pictures']);
if ($row['type'] == 'house') {
switch($row['house_type']) {
case 'one_room':
$house_type = 'One room';
break;
case 'self_contain':
$house_type = 'self contain';
break;
case 'one_bedroom':
$house_type = 'One bedroom';
break;
case 'two_bedroom':
$house_type = 'Two bedroom';
break;
}
}
for ($x =0; $x < count($pictures); $x++) {
if ($pictures[$x] == ""){
unset($pictures[$x]);
}
}
?>
<!--Carousel Wrapper-->
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<!--Slides-->
<div class="carousel-inner" role="listbox">
<?php
for ($x =0; $x < count($pictures); $x++) {
if ($x == 0) {
echo "<div class='carousel-item active view-image'>
<img class='d-block w-100' src='uploads/$pictures[$x]'>
</div>";
}
else {
echo "<div class='carousel-item view-image'>
<img class='d-block w-100' src='uploads/$pictures[$x]'>
</div>";
}
}
?>
</div>
<!--/.Slides-->
<!--Controls-->
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--/.Controls-->
</div>
<?php }
?>
</div>
<div class="col-md-5">
<div class="card text-left">
<div class="card-header">
<span class="card-title">House details</span>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<table class="table">
<tr>
<td>1</td>
<td>House type</td>
<td><?php echo $house_type; ?></td>
</tr>
<tr>
<td>2</td>
<td>Max no. occupants</td>
<td><?php echo $row['max_occupants']; ?></td>
</tr>
<tr>
<td>3</td>
<td>Price</td>
<td>N<?php echo $row['price']; ?></td>
</tr>
<tr>
<td>4</td>
<td>Wardrobe</td>
<td>
<?php
if ($row['wardrobe'] == 1){
echo "Available";
}
else {
echo "Not available";
}
?>
</td>
</tr>
<tr>
<td>5</td>
<td>Fence</td>
<td>
<?php
if ($row['fence'] == 1){
echo "Available";
}
else {
echo "Not available";
}
?>
</td>
</tr>
</table>
</div>
<div class="col-md-6">
<table class="table">
<tr>
<td>6</td>
<td>Kitchen cabinet</td>
<td>
<?php
if ($row['k_cabinet'] == 1){
echo "Available";
}
else {
echo "Not available";
}
?>
</td>
</tr>
<tr>
<td>7</td>
<td>Ceiling fan</td>
<td>
<?php
if ($row['c_fan'] == 1){
echo "Available";
}
else {
echo "Not available";
}
?>
</td>
</tr>
<tr>
<td>8</td>
<td>Location</td>
<td><?php echo $row['location']; ?></td>
</tr>
<tr>
<td>9</td>
<td>Other details</td>
<td><?php echo $row['more_details']; ?></td>
</tr>
</table>
<a href="uploadhouse.php?edit=<?php echo $row['id']?>" class="btn btn-green btn-sm m-0">Call agent</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once('components/footer.php'); ?>