-
Notifications
You must be signed in to change notification settings - Fork 4
/
view_drivers.php
executable file
·50 lines (40 loc) · 1.07 KB
/
view_drivers.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
<?php
include 'header.php';
echo '<div class="container">
<h1>
Driver list
</h1>
<br>
<br><br>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Trips</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>';
include_once 'mysqli.php';
if(!isset($mysqli)) $mysqli = new mysqli($server, $user, $pass, $db);
$query = "SELECT u.user_id, u.firstname, u.lastname, count(b.booking_id) as trips FROM `users` u, `booking` b WHERE u.group = 'Driver' AND u.user_id=b.driver_id GROUP BY b.driver_id ";
$result = mysqli_query($mysqli, $query);
while($row=mysqli_fetch_assoc($result))
{
echo '<tr>
<th scope="row">'.$row['user_id'].'</th>
<td>'.$row['firstname'].' '.$row['lastname'].'</td>
<td>'.$row['trips'].'</td>
<td>
<div class="btn-group" role="group">
<a href="monthly_report_driver.php?id='.$row['user_id'].'" class="btn btn-secondary btn-info">View Driver Report</a>
</div>
</td>
</tr>';
}
echo '</tbody>
</table>
</div>';
include 'footer.php';
?>