Anyone knows what I'm doing wrong here? I am getting supplied argument is not a valid MySQL result resource in line 34
<?php
//Connect to database server
$conn=mysql_connect("mywebsite", "user", "pass");
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("data", $conn);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>gg</title>
</head>
<body>
<?php
$result= mysql_query("SELECT student.First_Name AS first,
student.Last_Name AS last,
faculty.First_Name AS afirst,
faculty.Last_Name AS alast,
faculty.Office AS office,
faculty.Phone AS phone
FROM Student
INNER JOIN Faculty
ON Student.Advisor_ID=Faculty.Faculty_ID
ORDER BY last, first, afirst, alast, office, phone;");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
echo '<h2>Students and Advisors</h2>';
echo '<table width="100%" border="2">';
echo '<tr>';
echo '<th>Student First Name</th>';
echo '<th>Student Last Name</th>';
echo '<th>Student Advisors First Name</th>';
echo '<th>Student Advisors Last Name</th>';
echo '<th>Advisor Office</th>';
echo '<th>Advisor Phone</th>';
echo '</tr>';
echo '<tr>';
echo "<td>".$row['first']."</td>";
echo "<td>".$row['last']."</td>";
echo "<td>".$row['afirst']."</td>";
echo "<td>".$row['alast']."</td>";
echo "<td>".$row['office']."</td>";
echo "<td>".$row['phone']."</td>";
echo '</tr>';
echo '</table>';
}
mysql_close($conn);
?>
</body>
</html>