Im getting this error:
Parse error: syntax error, unexpected $end in /hsphere/local/home/blah/blahblah.com/home/phonenumber.php on line 188. Problem is line 188 is </html> only. Also, I'm having problem making this code to work, it doesnt display the tables that I want
<?php
$selection = $_POST['person'];
$conn = mysql_connect("mrrrr.com","yyyyy","yyfffsd");
mysql_select_db("hhhh_ggg", $conn);
// For Students
if ($selection == 'student') {
$sql="SELECT student.first_name AS first,
student.last_name AS last,
student.phone AS phonenum
FROM student
ORDER BY last, first;";
$result = mysql_query($sql, $conn)
or die(mysql_error());
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml">';
echo '<head>';
echo '<title>Student Phone Book</title>';
echo '</head>';
echo '<body>';
echo '<h2>Student Phone Book</h2>';
echo '<table width="100%" border="2">';
echo '<tr>';
echo '<th>First Name</th>';
echo '<th>Last Name</th>';
echo '<th>Phone</th>';
echo '</tr>';
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>";
echo $row["first"];
echo "</td>";
echo "<td>";
echo $row["last"];
echo "</td>";
echo "<td>";
echo $row["phonenum"];
echo "</td>";
echo "</tr>";
}
echo '</table>';
mysql_close($conn);
//faculty
if ($selection == 'faculty') {
$sql="SELECT faculty.first_name AS first,
faculty.last_name AS last,
faculty.phone AS phonenum
FROM faculty
ORDER BY last, first;";
$result = mysql_query($sql, $conn)
or die(mysql_error());
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml">';
echo '<head>';
echo '<title>Faculty Phone Book</title>';
echo '</head>';
echo '<body>';
echo '<h2>Faculty Phone Numbers</h2>';
echo '<table width="100%" border="2">';
echo '<tr>';
echo '<th>First Name</th>';
echo '<th>Last Name</th>';
echo '<th>Phone</th>';
echo '</tr>';
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>";
echo $row["first"];
echo "</td>";
echo "<td>";
echo $row["last"];
echo "</td>";
echo "<td>";
echo $row["phonenum"];
echo "</td>";
echo "</tr>";
}
echo '</table>';
mysql_close($conn);
//department
if ($selection == 'department') {
$sql="SELECT department.first_name AS first,
department.last_name AS last,
department.phone AS phonenum
FROM department
ORDER BY last, first;";
$result = mysql_query($sql, $conn)
or die(mysql_error());
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml">';
echo '<head>';
echo '<title>Student Phone Book</title>';
echo '</head>';
echo '<body>';
echo '<h2>Department Phone Numbers</h2>';
echo '<table width="100%" border="2">';
echo '<tr>';
echo '<th>First Name</th>';
echo '<th>Last Name</th>';
echo '<th>Phone</th>';
echo '</tr>';
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>";
echo $row["first"];
echo "</td>";
echo "<td>";
echo $row["last"];
echo "</td>";
echo "<td>";
echo $row["phonenum"];
echo "</td>";
echo "</tr>";
}
echo '</table>';
mysql_close($conn);
//student
if ($selection == 'studentid') {
$sql="SELECT student.first_name AS first,
student.last_name AS last,
student.phone AS phonenum
FROM student
ORDER BY last, first;";
$result = mysql_query($sql, $conn)
or die(mysql_error());
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml">';
echo '<head>';
echo '<title>Student Phone Book</title>';
echo '</head>';
echo '<body>';
echo '<h2>Student Phone Book</h2>';
echo '<table width="100%" border="2">';
echo '<tr>';
echo '<th>First Name</th>';
echo '<th>Last Name</th>';
echo '<th>Phone</th>';
echo '</tr>';
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>";
echo $row["first"];
echo "</td>";
echo "<td>";
echo $row["last"];
echo "</td>";
echo "<td>";
echo $row["phonenum"];
echo "</td>";
echo "</tr>";
}
echo '</table>';
mysql_close($conn);
}
?>
<a href="test2.htm">Back to previous page</a>
</body>
</html>