-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproperty_list_without_react.php
85 lines (69 loc) · 2.12 KB
/
property_list_without_react.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
<?php
session_start();
require "includes/database_connect.php";
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : NULL;
$city_name = $_GET["city"];
$sql_1 = "SELECT * FROM cities WHERE name = '$city_name'";
$result_1 = mysqli_query($conn, $sql_1);
if (!$result_1) {
echo "Something went wrong!";
return;
}
$city = mysqli_fetch_assoc($result_1);
if (!$city) {
echo "Sorry! We do not have any PG listed in this city.";
return;
}
$city_id = $city['id'];
$sql_2 = "SELECT * FROM properties WHERE city_id = $city_id";
$result_2 = mysqli_query($conn, $sql_2);
if (!$result_2) {
echo "Something went wrong!";
return;
}
$properties = mysqli_fetch_all($result_2, MYSQLI_ASSOC);
$sql_3 = "SELECT *
FROM interested_users_properties iup
INNER JOIN properties p ON iup.property_id = p.id
WHERE p.city_id = $city_id";
$result_3 = mysqli_query($conn, $sql_3);
if (!$result_3) {
echo "Something went wrong!";
return;
}
$interested_users_properties = mysqli_fetch_all($result_3, MYSQLI_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Best PG's in <?php echo $city_name ?> | PG Life</title>
<?php
include "includes/head_links.php";
?>
<link href="css/property_list.css" rel="stylesheet" />
</head>
<body>
<?php
include "includes/header.php";
?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb py-2">
<li class="breadcrumb-item">
<a href="index.php">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
<?php echo $city_name; ?>
</li>
</ol>
</nav>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<?php
include "includes/signup_modal.php";
include "includes/login_modal.php";
include "includes/footer.php";
?>
<script defer="defer" src="/static/js/main.e4c2275a.js"></script>
</body>
</html>