-
Notifications
You must be signed in to change notification settings - Fork 51
/
schedule.php
66 lines (54 loc) · 2.01 KB
/
schedule.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
<html>
<body style=" background-image: url(adminlogin.jpeg);
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;">
<?php
require "db.php";
$cdquery="SELECT * FROM train WHERE trainno='".$_GET["trainno"]."'";
$cdresult=mysqli_query($conn,$cdquery);
echo "
<table>
<thead><td>Train_no</td><td>Train_name</td><td>Starting_Point</td><td>Arrival_Time</td><td>Destination_Point</td><td>Departure_Time</td><td>Day</td><td>Distance</td></thead>
";
while ($cdrow=mysqli_fetch_array($cdresult))
{
echo "
<tr><td>".$cdrow['trainno']."</td><td>".$cdrow['tname']."</td><td>".$cdrow['sp']."</td><td>".$cdrow['st']."</td><td>".$cdrow['dp']."</td><td>".$cdrow['dt']."</td><td>".$cdrow['dd']."</td><td>".$cdrow['distance']."</td></tr>
";
}
echo "</table>";
$cdquery="SELECT * FROM schedule where trainno='".$_GET["trainno"]."' ORDER BY distance ASC ";
$cdresult=mysqli_query($conn,$cdquery);
$stations=array();
$arrival=array();
$departure=array();
$distance=array();
$i=0;
while($cdrow=mysqli_fetch_array($cdresult))
{
$stations[$i]=$cdrow["sname"];
$arrival[$i]=$cdrow["arrival_time"];
$departure[$i]=$cdrow["departure_time"];
$distance[$i]=$cdrow["distance"];
$i+=1;
}
echo "
<table>
<thead><td>Id</td><td>Staring_Point</td><td>Arrival_Time</td><td>Destination_Point</td><td>Departure_Time</td><td>Distance</td><td></td></thead>
";
$temp=0;
while ($temp<$i-1)
{
echo "
<tr><td>".($temp+1)."</td><td>".$stations[$temp]."</td><td>".$departure[$temp]."</td><td>".$stations[$temp+1]."</td><td>".$arrival[$temp+1]."</td><td>".($distance[$temp+1]-$distance[$temp])."</td><td><a href=\"http://localhost/railway/seat_plan.php?trainno=".$_GET["trainno"]."&sp=".$stations[$temp]."&dp=".$stations[$temp+1]."\"><button>Seat Plan</button></a></td></tr>
";
$temp+=1;
}
echo "</table>";
echo " <br><a href=\"http://localhost/railway/show_trains.php\">Go Back to Train Menu!!!</a><br> ";
echo " <br><a href=\"http://localhost/railway/admin_login.php\">Go Back to Admin Menu!!!</a> ";
?>
</body>
</html>