-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuy.php
167 lines (152 loc) · 8.61 KB
/
buy.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
<?php
session_start();
include 'database/db_connection.php';
include 'helpers/function.php';
include'include/header.php';
?>
<!-- banner -->
<div class="inside-banner">
<div class="container">
<span class="pull-right"><a href="index.php">Home</a> / Buy</span>
<h2>Buy</h2>
</div>
</div>
<!-- banner -->
<div class="container">
<div class="properties-listing spacer">
<div class="row">
<div class="col-lg-3 col-sm-4 ">
<div class="search-form">
<h4><span class="glyphicon glyphicon-search"></span> Search for</h4>
<form action="search-result.php" method="GET">
<input type="text" name="area_name" class="form-control" placeholder="Search of Area">
<div class="row">
<div class="col-lg-12">
<select class="form-control" name="property_for">
<option value="sale">Buy</option>
<option value="rent">Rent</option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-6">
<input name="min" type="text" class="form-control input-md" placeholder="min-price">
</div>
<div class="col-md-6">
<input name="max" type="text" class="form-control input-md" placeholder="max-price">
</div>
</div>
<button type="submit" name="search" class="btn btn-primary">Find Now</button>
</form>
</div>
<div class="hot-properties hidden-xs">
<h4>Hot Properties</h4>
<?php
global $con;
$pquery = "SELECT * FROM tbl_flat_sell_ads WHERE approved='Y' AND sold='0' AND ban='N' ORDER BY id DESC LIMIT 5 ";
$presult = mysqli_query($con, $pquery);
if($presult){
while ($prow = mysqli_fetch_array($presult)) {
?>
<div class="row">
<div class="col-lg-4 col-sm-5">
<a href="property-detail.php?flat_sale_id=<?php echo $prow['id'];?>">
<img src="<?php echo $prow['flat_image'];?>" class="img-responsive img-circle" alt="properties"/>
</a>
</div>
<div class="col-lg-8 col-sm-7">
<h5><a href="property-detail.php?flat_sale_id=<?php echo $prow['id'];?>"><?php echo $prow['building_name'];?></a></h5>
<p class="price">Price: <?php echo number_format($prow['price'],2);?>Tk</p>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<div class="col-lg-9 col-sm-8">
<div class="row">
<?php
global $con;
$per_page = 6;
if(isset($_GET['page'])){
$page = $_GET['page'];
}else{
$page = 1;
}
$start_from = ($page-1)*$per_page;
?>
<!--pagination-->
<?php
$query = "SELECT * FROM tbl_flat_sell_ads WHERE approved='Y' AND ban='N' ORDER BY id DESC LIMIT $start_from,$per_page ";
$result = mysqli_query($con,$query);
if($result){
while ($row = mysqli_fetch_array($result)){
?>
<div class="col-lg-4 col-sm-6">
<div class="properties">
<div class="image-holder">
<a href="property-detail.php?flat_sale_id=<?php echo $row['id'];?>">
<img src="<?php echo $row['flat_image'];?>" class="img-responsive" alt="properties" style="height: 150px;width:100%;"/>
</a>
<?php
if($row['sold'] == '1'){
?>
<div class="status sold">Sold</div>
<?php
}
?>
</div>
<h4><a href="property-detail.php?flat_sale_id=<?php echo $row['id'];?>"><?php echo $row['building_name'];?></a></h4>
<?php
if($row['sold'] == '0'){
?>
<p class="price">Price: <?php echo number_format($row['price'],2);?>Tk</p>
<?php
}else{
?>
<p class="price">Price: <del><?php echo number_format($row['price'],2);?></del>Tk</p>
<?php
}
?>
<div class="listing-detail">
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Bed Room"><?php echo $row['total_bedroom'];?></span>
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Living Room"><?php echo $row['total_livingroom'];?></span>
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Bath Room"><?php echo $row['total_bathroom'];?></span>
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Kitchen Room"><?php echo $row['total_kitchenroom'];?></span>
</div>
<a class="btn btn-primary" href="property-detail.php?flat_sale_id=<?php echo $row['id'];?>">View Details</a>
</div>
</div>
<?php
}
?>
<div class="col-lg-12">
<div class="center">
<?php
$squery = "SELECT * FROM tbl_flat_sell_ads";
$sresult = mysqli_query($con,$squery);
$total_rows = mysqli_num_rows($sresult);
$total_pages = ceil($total_rows/$per_page);
echo "<ul class='pagination'><li><a href='buy.php?page=1'>".'First Page'."</a></li>";
for($i=1;$i<=$total_pages;$i++){
echo "<li><a href='buy.php?page=".$i."'>".$i."</a></li>";
}
echo "<li><a href='buy.php?page=$total_pages'>".'Last page'."</a></li></ul>";
?>
</div>
</div><!--pagination-->
<?php
}else{
header("Location:404.php");
}
?>
<!-- Pagination Section Start-->
<!-- Pagination Section End-->
</div>
</div>
</div>
</div>
</div>
<?php include'include/footer.php';?>