forked from tasminoni/CSE370-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_review_rating.php
53 lines (39 loc) · 1.72 KB
/
view_review_rating.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
<?php
$conn = new mysqli("localhost", "root", "", "db");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_GET['Flatid'])) {
$Flatid = $_GET['Flatid'];
$sql = "SELECT a.Flatid, a.flat_type, r.review, r.rating, r.username FROM addproperty a LEFT JOIN reviews_ratings r ON a.Flatid = r.Flatid WHERE a.Flatid = $Flatid";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<div style='margin-top: 30px; background-color: rgba(0, 0, 0, 0.6); padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);'>";
echo "<h2 style='border-bottom: 2px solid white; padding-bottom: 5px;'>Reviews and Ratings for Flat ID: " . $row['Flatid'] . "</h2>";
echo "<p><strong>Flat Type:</strong> " . $row['flat_type'] . "</p>";
if (!empty($row['username'])) {
echo "<p><strong>User Name:</strong> " . $row['username'] . "</p>";
} else {
echo "<p>No username available.</p>";
}
if (!empty($row['review'])) {
echo "<p><strong>Review:</strong> " . $row['review'] . "</p>";
} else {
echo "<p>No reviews available.</p>";
}
if (!empty($row['rating'])) {
echo "<p><strong>Rating:</strong> " . $row['rating'] . "</p>";
} else {
echo "<p>No ratings available.</p>";
}
echo "</div>";
}
} else {
echo "<p>No reviews and ratings found for this property.</p>";
}
} else {
echo "<p>No Flatid provided in the URL.</p>";
}
$conn->close();
?>