-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery3b.php
More file actions
39 lines (22 loc) · 913 Bytes
/
Copy pathquery3b.php
File metadata and controls
39 lines (22 loc) · 913 Bytes
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
<?php
$conn=mysqli_connect("db.soic.indiana.edu","i308s17_team87","my+sql=i308s17_team87", "i308s17_team87");
// Check connection
if (!$conn)
{die("Failed to connect to MySQL: " . mysqli_connect_error()); }
else
{ echo "Established Database Connection" ;}
$courseid = mysqli_real_escape_string($conn, $_POST['course']);
$sql = "SELECT f.facultyID as id, concat(f.fname, ' ',f.lname) as name FROM faculty as f WHERE not exists(SELECT * FROM section as s, course as c WHERE f.facultyID=s.facultyID and s.courseID = c.courseID and c.courseID='$courseid');";
$result = mysqli_query($conn,$sql);
if (mysqli_num_rows($result) > 0)
{
echo "<table><tr><th>FacultyID</th><th>Name</th></tr>";
while($row = mysqli_fetch_assoc($result)) {
echo "<tr><td>".$row["id"]. "</td><td>".$row["name"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
mysqli_close($conn);
?>