-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchReservations.php
52 lines (40 loc) · 1.34 KB
/
SearchReservations.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
<?php
$data = [];
$i = 0;
$string = "";
$Sdate = $_POST['Sdate'];
$Edate = $_POST['Edate'];
$connection = mysqli_connect('localhost','root','','car_rental_system');
if (!empty($Sdate) && !empty($Edate)) {
$string = $string."WHERE res_date >= '" . $Sdate . "' AND res_date <= '" . $Edate . "'";
}
$sql = "SELECT * FROM report1 $string";
$query = mysqli_query($connection,$sql);
$num_rows = mysqli_num_rows($query);
if($num_rows!=0)
{
while($row=mysqli_fetch_assoc($query))
{
$response[$i]['id'] = $row['res_id'];
$response[$i]['cid'] = $row['customer_id'];
$response[$i]['fn'] = $row['first_name'];
$response[$i]['ln'] = $row['last_name'];
$response[$i]['e'] = $row['email'];
$response[$i]['phn'] = $row['phone_no'];
$response[$i]['st'] = $row['Street_name'];
$response[$i]['ct'] = $row['city'];
$response[$i]['ctr'] = $row['country'];
$response[$i]['cr'] = $row['car_id'];
$response[$i]['m'] = $row['model'];
$response[$i]['y'] = $row['year'];
$response[$i]['c'] = $row['color'];
$response[$i]['s'] = $row['status'];
$response[$i]['o'] = $row['off_id'];
$response[$i]['p'] = $row['price_per_day'];
$data[$i] = $response[$i];
$i +=1;
}
session_start();
}
mysqli_close($connection);
echo json_encode($data);