-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
121 lines (91 loc) · 3.82 KB
/
index.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
<?php include 'inc/header.php'; ?>
<?php include 'inc/slider.php'; ?>
<div class="contentsection contemplete clear">
<div class="maincontent clear">
<tr>
<td>
<label>Select your Location:</label>
</td>
<td>
<select id="select" name="cat">
<option>Select Location</option>
<?php
$query = "SELECT * FROM tbl_Location";
$location = $db->select($query);
if ($location){
while ($result = $location->fetch_assoc()) {
?>
<option value="<?php echo $result['id'] ?>"><?php echo $result['name']; ?></option>
<?php } } ?>
</select>
</td>
</tr>
<tr style="margin-right: 100px;">
<td> </td>
<td>
<label>. Select Range Price:</label>
</td>
<td>
<select id="select" name="cat">
<option>Select Range</option>
<?php
$query = "SELECT * FROM tbl_price";
$category = $db->select($query);
if ($category){
while ($result = $category->fetch_assoc()) {
?>
<option value="<?php echo $result['id'] ?>"><?php echo $result['amount']; ?></option>
<?php } } ?>
</select>
</td>
</tr>
</div>
<div class="sidebar clear">
<h2 style="text-align: center;">Find Your Home</h2>
</div>
<div class="maincontent clear">
<!--pagination -->
<?php
$per_page = 3;
if(isset($_GET["page"])){
$page = $_GET["page"];
}else{
$page = 1;
}
$start_form = ($page-1) * $per_page;
?>
<?php
$query = "select * from tbl_post order by id desc limit $start_form, $per_page";
$post = $db->select($query);
//var_dump($query);
if ($post) {
while ($result = $post->fetch_assoc()) {
?>
<div class="samepost clear">
<h2><a href=" post.php?id=<?php echo $result['id'];?>"><?php echo $result['title'];?></a></h2>
<h4><?php echo $fm->formatDate($result['date']); ?>, By <a href = "#"><?php echo $result['author'];?></a></h4>
<a href = "#"><img src="admin/<?php echo $result['image']; ?>" alt="post image"/></a>
<?php echo $fm->textShorten($result['body']); ?>
<div class="readmore clear">
<a href = "post.php?id=<?php echo $result['id']; ?>">Read More</a>
</div>
</div>
<?PHP } ?>
<?php
$query = "select * from tbl_post";
$result = $db->select($query);
$total_rows = mysqli_num_rows($result);
$total_pages = ceil($total_rows/$per_page);
echo "<span class='pagination'><a href='index.php?page=1'>".'First Page'."</a>";
for ($i=1; $i <= $total_pages; $i++){
echo "<a href='index.php?page=".$i."'>".$i."</a>";
};
echo "<a href='index.php?page=$total_pages'>".'Last Page'."</a></span>"?>
<?php
} else {
header("Location:404.php");
}
?>
</div>
<?php include 'inc/sidebar.php'; ?>
<?php include 'inc/footer.php'; ?>