-
Notifications
You must be signed in to change notification settings - Fork 1
/
server2.php
30 lines (27 loc) · 922 Bytes
/
server2.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
<?php
$from="";
$to="";
$x="";
$errors=array();
$db=mysqli_connect('localhost','root','','registration');
//if registration button is clicked
if(isset($_POST['trains'])){
$from=mysqli_real_escape_string($db,$_POST['from']);
$to=mysqli_real_escape_string($db,$_POST['to']);
$date=mysqli_real_escape_string($db,$_POST['date']);
$classes=mysqli_real_escape_string($db,$_POST['classes']);
$q2="SELECT DAYNAME('$date') as days";
$r2=mysqli_query($db,$q2);
$row = mysqli_fetch_assoc($r2);
$y=$row['days'];
$q="SELECT * FROM train_info,train_schedule WHERE Source_Station_Name='$from' AND Destination_Station_Name='$to' AND days<>'$y' AND train_info.Train_No=train_schedule.Train_No";
$r=mysqli_query($db,$q);
}
if(isset($_POST['reverse'])){
$from2=mysqli_real_escape_string($db,$_POST['from2']);
$to2=mysqli_real_escape_string($db,$_POST['to2']);
$x=$from2;
$from2=$to2;
$to2=$x;
}
?>