-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadditional2.php
More file actions
32 lines (22 loc) · 855 Bytes
/
Copy pathadditional2.php
File metadata and controls
32 lines (22 loc) · 855 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
<?php
$conn=mysqli_connect("db.soic.indiana.edu","i308s18_team30","my+sql=i308s18_team30", "i308s18_team30");
// Check connection
if (!$conn)
{die("Failed to connect to MySQL: " . mysqli_connect_error()); }
else
{ echo "Established Database Connection" ;}
$departmentid = mysqli_real_escape_string($conn,$_POST['department']);
$sql="SELECT CONCAT(f.FirstName,' ',f.LastName) AS Name FROM Faculty AS f, Department as d WHERE f.DepartmentID = d.DepartmentID AND d.DepartmentID = $departmentid GROUP BY f.FacultyID;";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table border='1'><tr><th>Name</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["Name"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
mysqli_close($conn);
?>