-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6c.php
More file actions
49 lines (40 loc) · 1.44 KB
/
Copy path6c.php
File metadata and controls
49 lines (40 loc) · 1.44 KB
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
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<?php
$conn=mysqli_connect("db.soic.indiana.edu","i308s18_team30","my+sql=i308s18_team30",
"i308s18_team30");
// Check connection
if (mysqli_connect_errno())
{echo nl2br("Failed to connect to MySQL: " . mysqli_connect_error() . "\n "); }
else
{echo nl2br("Established Database Connection \n");}
$building = mysqli_real_escape_string($conn,$_POST['building']);
$day = mysqli_real_escape_string($conn,$_POST['day']);
$time = mysqli_real_escape_string($conn,$_POST['time']);
$sql="CONCAT(f.Firstname,' ',f.Lastname) AS faculty_name, CONCAT(s.Firstname,' ',s.Lastname) AS student_name
FROM Student AS s, Faculty AS f, Building AS b, Office AS o, Section as se, Students_taking_courses AS stc
WHERE f.DepartmentID = b.DepartmentID AND o.BuildingID = b.BuildingID AND f.OfficeID = o.OfficeID AND stc.SectionID = se.SectionID AND stc.StudentID = s.StudentID AND stc.CourseID = f.CourseID AND b.BuildingID = $building AND se.Time = $time";
$result = mysqli_query($conn,$sql);
if (mysqli_num_rows($result) > 0) {
echo "<table border='1'><tr><th>faculty_name</th><th>Student_name</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo
"<tr><td>".$row["faculty_name"]."</td></tr>".$row["student_name"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
mysqli_close($conn);
?>
</body>
</html>