-
Notifications
You must be signed in to change notification settings - Fork 0
/
flat.php
118 lines (90 loc) · 2.57 KB
/
flat.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Advertise</title>
<?php include_once("head_include.php"); ?>
</head>
<body data-spy="scroll" data-target=".navbar" data-offset="50">
<?php include_once("body_head.php"); ?>
<div class="container-fluid">
<div class="row">
<div class="col-md-8 col-md-offset-2 box">
<?php
// database connection stuff here
error_reporting(0);
$type="Flat";
if (!isset($screen))
$screen = 0;
$rows_per_page = 10;
$start = $screen * $rows_per_page;
$sql = "SELECT * FROM property WHERE type ='{$type}' ";
$sql .= "LIMIT $start, $rows_per_page";
$result = query($sql);
$total_records = mysqli_num_rows($result);
$pages = ceil($total_records / $rows_per_page);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
<div class="display_row">
<div class="picture">
<?php
$id = $row["id"];
$sql1 = "Select * from propertyphoto where id = '{$id}'";
$result1 = query($sql1);
if ($result1->num_rows > 0) {
// output data of each row
while($row1 = $result1->fetch_assoc()) {
$photoid = $row1["photoid"];
$dir = "uploads";
$filename = $photoid . ".png";
echo "<img src='$dir/$filename'>";
}
}
?>
</div>
<div class="text">
<?php
echo "Name: " . $row['name'] . "<br> Location:" .$row['address'] ." <br> Price:" . $row['price']. "<br>";
?>
<form method="post" action="property_info.php">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input class="btn btn-primary" type="submit" name="submit" value="Details">
</form>
</div>
</div>
<?php
}
}
else
{
$error="No result found!!";
$message = <<<DELIMITER
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Sorry!</strong> $error</div>
DELIMITER;
echo $message;
}
// let's create the dynamic links now
if ($screen > 0) {
$url = "example.php?screen=" . $screen - 1;
echo "<a href=\"$url\">Previous</a>\n";
}
// page numbering links now
for ($i = 0; $i < $pages; $i++) {
$url = "example.php?screen=" . $i;
echo " | <a href=\"$url\">$i</a> | ";
}
if ($screen < $pages) {
$url = "example.php?screen=" . $screen + 1;
echo "<a href=\"$url\">Next</a>\n";
}
?>
</div>
<div class="col-md-2"></div>
</div>
<?php include_once("body_foot.php"); ?>
</div>
</body>
</html>