我试图从 elective_mgmt 数据库的优先级表中获取数据。源代码如下:
<?php
$connect = mysql_connect("localhost","root","");
mysql_select_db("elective_mgmt",$connect);
$result = mysql_query($con,"SELECT * FROM priority");
echo "<table border='1'>
`<tr>
<th>Name</th>
<th>Roll</th>
<th>Email</th>
<th>Priorityone</th>
<th>Prioritytwo</th>
<th>Prioritythree</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Roll'] . "</td>";
echo "<td>" . $row['Email']. "</td>";
echo "<td>" . $row['Priorityone']."</td>";
echo "<td" . $row['Prioritytwo']."</td>";
echo "<td" . $row['Prioritythree']."</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
?>
当我运行它时,它显示如下:
Warning: mysql_query() expects parameter 2 to be resource, string given in C:\xampp\htdocs\Elective_management\admin_view.php on line 5
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\Elective_management\admin_view.php on line 15
Name Roll Email Priorityone Prioritytwo Prioritythree
Warning: mysql_close() expects parameter 1 to be resource, null given in C:\xampp\htdocs\Elective_management\admin_view.php on line 28
?>
我没有任何想法。请帮我。