-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch (2).php
58 lines (42 loc) · 1.09 KB
/
search (2).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
<?php
$response=array();
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
$roomQuery="";
$areaQuery="";
$rooms=$_GET['Room_No'];
$area=$_GET['Area'];
$pq1=$_GET['Price1'];
$pq2=$_GET['Price2'];
$pq="";
$sz1=$_GET['Size1'];
$sz2=$_GET['Size2'];
$sz="";
$type1=$_GET['Type1'];
$tq="";
$type2=$_GET['Type2'];
if(!empty($_GET['Room_No'])) $roomQuery=" AND Room_No = $rooms";
if(!empty($_GET['Area'])){
$areaQuery=" AND Area='$area'";
}
if(!empty($_GET['Price1']) && !empty($_GET['Price2'])){
$pq=" AND (Price BETWEEN $pq1 AND $pq2)";
}
if(!empty($_GET['Size1']) && !empty($_GET['Size2'])){
$sz=" AND (Size BETWEEN $sz1 AND $sz2)";
}
if(!empty($_GET['Type2'])){
$tq=" AND Type2='$type2'";
}
$query2= "SELECT * FROM `Post` WHERE Type1='$type1'".$roomQuery."".$areaQuery."".$pq."".$sz."".$tq;
echo $query2;
$result=mysql_query($query2);
//$cnt=0;
while($r = mysql_fetch_assoc($result)) {
$response[] = $r;
//echo $cnt++;
}
print json_encode($response)
?>