-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.php
94 lines (71 loc) · 1.95 KB
/
display.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
<?php
//SEND DATA TO DATABASE
$server = "localhost";
$user = "root";
$pwd = "";
/* $server = "localhost";
$user = "id1088606_root";
$pwd = "password"; */
//CONNECT TO DATABASE
//$db = "id1088606_bimtravel";
$db = "bimtravel";
$con = mysqli_connect($server, $user, $pwd, $db);
//TYPE OF VEHICLE 1
$sql = "SELECT * FROM vehicles WHERE Type='blue bus'";
$q = mysqli_query($con, $sql);
$type1 = mysqli_num_rows($q);
//TYPE OF VEHICLE 2
$sql2 = "SELECT * FROM vehicles WHERE Type='mini bus'";
$q2 = mysqli_query($con, $sql2);
$type2 = mysqli_num_rows($q2)
?>
<div id="display">
<div id="imgs">
<img src="imgs/bus.png" style="width: 500px;"/>
<img src="imgs/minivan.png" style="float: right;" />
</div>
<br/><br/>
<div id="counter-container">
<div class="counter" style="float: left">
<span class="inner-counter"><?php echo $type1;?></span>
<span class="smalltext">Blue Bus</span>
</div>
<div class="counter" style="float: right;">
<span class="inner-counter"><?php echo $type2;?></span>
<span class="smalltext">Mini Bus</span>
</div>
</div>
</div>
<table>
<tr>
<th>Vehicle No.</th>
<th>Driver</th>
<th>Route</th>
<th>Type</th>
<th>Operation</th>
<th>Location</th>
</tr>
<?php
$sql = "SELECT * FROM vehicles";
$q = mysqli_query($con, $sql);
if(!$con || !$db ||!$q ){
die('Error: '.mysqli_error($con));
echo 'something went wrong';
}
else{
while($row = mysqli_fetch_assoc($q)){
echo '
<tr>
<td> '.$row["vehicle_no"].'</td>
<td> '.$row["driver"].'</td>
<td> '.$row["route"].'</td>
<td> '.$row["type"].'</td>
<td> '.$row["operational"].'</td>
<td> '.$row["location"].'</td>
</tr>
';
}
}
mysqli_close($con);
?>
</table>