-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetrecord.php
113 lines (108 loc) · 2.81 KB
/
getrecord.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
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
<table id="example" class="display" cellspacing="0" width="100%">
<!-- <thead>
<tr>
<th>Order ID</th>
<th>Restaurant Name</th>
<th>Restaurant Location</th>
<th>Destination</th>
<th>Tip</th>
<th>Quantity</th>
<th>Total Price</th>
<th>Date</th>
</tr>
</thead> -->
<thead>
<tr>
<th>Order ID</th>
<th>Restaurant Name</th>
<th>Tip</th>
<th>Service</th>
<th>Total Price</th>
</tr>
</thead>
<!--<tfoot>
<tr>
<th>Order ID</th>
<th>Restaurant Name</th>
<th>Restaurant Location</th>
<th>Destination</th>
<th>Tip</th>
<th>Quantity</th>
<th>Total Price</th>
<th>Date</th>
</tr>
</tfoot>
<tbody> -->
<?php
include('connect.php');
if(!empty($_POST["empID"])){
$emppid = $_POST['empID'];
/*$query = "SELECT
OI.orderid,
OI.tip,
OI.destination,
IC.totalprice,
IC.quantity,
r.restaurantname,
r.restaurantlocation,
ISIN.timeupdate
FROM
orderinformation as OI
INNER JOIN
isin as ISIN ON ( ISIN.orderid = OI.orderid )
INNER JOIN
itemcart as IC ON (IC.orderid = OI.orderid )
INNER JOIN
restaurants as r ON (r.restaurantid = IC.restaurantid)
WHERE
OI.employeeid=".$emppid." ";*/
$query = "SELECT
OI.orderid,
OI.tip,
e.servicecharge,
r.restaurantname,
IC.totalprice
FROM
orderinformation as OI
INNER JOIN
itemcart as IC ON (IC.orderid = OI.orderid)
INNER JOIN
restaurants as r ON (r.restaurantid = IC.restaurantid)
INNER JOIN
deliveryemployee as e ON (OI.employeeid = e.employeeid)
WHERE
OI.employeeid = ".$emppid." ";
$result = pg_query($db_connection, $query);
if(!empty($result)){
while ($record = pg_fetch_assoc($result) ) {
/*echo "<tr>
<td>{$record['orderid']}</td>
<td>{$record['restaurantname']}</td>
<td>{$record['restaurantlocation']}</td>
<td>{$record['destination']}</td>
<td>{$record['tip']}</td>
<td>{$record['quantity']}</td>
<td>{$record['totalprice']}</td>
<td>{$record['timeupdate']}</td>
<tr>"; */
echo "<tr>
<td>{$record['orderid']}</td>
<td>{$record['restaurantname']}</td>
<td>{$record['tip']}</td>
<td>{$record['servicecharge']}</td>
<td>{$record['totalprice']}</td>
<tr>";
}
}
else{
echo pg_last_error($db_connection);
}
}
?>
</tbody>
</table>