-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathefficiency.php
36 lines (27 loc) · 979 Bytes
/
efficiency.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
<?php
require "init.php";
echo "Efficiency of the total system<br><br>";
$sql="select * from bookingslot;";
$result=mysqli_query($con,$sql);
$requests=mysqli_num_rows($result);
echo "Number of requests:".$requests."<br>";
$sql="select * from bookingslot where halfway=1;";
$result=mysqli_query($con,$sql);
$success=mysqli_num_rows($result);
echo "Number of requests successfully served:".$success."<br>";
$eff=($success*100)/$requests;
$eff=number_format($eff,2);
echo "Efficiency=".$eff."<br><br><br>";
echo "Slot occupancy rate<br><br>";
$sql="select * from parkingslot;";
$result=mysqli_query($con,$sql);
$slots=mysqli_num_rows($result);
echo"Number of slots :".$slots."<br>";
$sql="select * from parkingslot where status=1";
$result=mysqli_query($con,$sql);
$occupied=mysqli_num_rows($result);
echo"Number of slots occupied:".$occupied."<br>";
$eff2=($occupied*100)/$slots;
echo "slot occupancy rate:".$eff2;
mysqli_close($con);
?>