-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
72 lines (58 loc) · 2.8 KB
/
index.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
67
68
69
70
71
72
<?php session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php include("mysqlkey.php"); include("mysqlconnect.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StudentView</title>
<style type="text/css">
body{
font-family: Trebuchet MS;
}
h1, h3, h4{
color: #980B1A;
}
div #tlogin{
font-size: 22px;
}
</style>
</head>
<body>
<h1>Senior Options - StudentView</h1>
<h3>Available teachers:</h3>
<ul> <!--The unordered list of teachers in the database.-->
<?php include("mysqlkey.php"); include("mysqlconnect.php");
$result = mysql_query("SELECT * FROM teachers ORDER BY lname,fname"); //Selects the information of all the teachers ordered by last name, primarily and first name secondarily.
while($row = mysql_fetch_array($result, MYSQL_BOTH)){ //Displays each teacher, the number of current maximum slots that each teacher has, and a text box that allows for the
//input of a new value of the number of maximum slots for each teacher.
$id = $row['teacher_id'];
$id = mysql_real_escape_string($id);
$count = mysql_num_rows(mysql_query("SELECT * FROM students where mentor=$id"));
$open = $row['max_slots'] - $count;
if($open>0)
echo "<li>".$row['fname']." ".$row['lname']." - Current Open Slots: ".$open.".</li><br/>"; //The teacher's number of maximum slots is stored in $_POST and is used
//to update the teachers table (see top of page).
}
?>
</ul>
<h3>Unavailable teachers:</h3>
<ul> <!--The unordered list of teachers in the database.-->
<?php include("mysqlkey.php"); include("mysqlconnect.php");
$result = mysql_query("SELECT * FROM teachers ORDER BY lname,fname"); //Selects the information of all the teachers ordered by last name, primarily and first name secondarily.
while($row = mysql_fetch_array($result, MYSQL_BOTH)){ //Displays each teacher, the number of current maximum slots that each teacher has, and a text box that allows for the
//input of a new value of the number of maximum slots for each teacher.
$id = $row['teacher_id'];
$id = mysql_real_escape_string($id);
$count = mysql_num_rows(mysql_query("SELECT * FROM students where mentor=$id"));
$open = $row['max_slots'] - $count;
if($open==0)
echo "<li>".$row['fname']." ".$row['lname']."</li><br/>"; //The teacher's number of maximum slots is stored in $_POST and is used
//to update the teachers table (see top of page).
}
?>
</ul>
<div id='tlogin'><a href='login.php'>Teacher Log In</a></div> <!--Log in.-->
</body>
</html>