I have tried to fetch data from priority table of elective_mgmt database.The source code is given below :
<?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);
?>
?>
When I run it ,it displays like this:
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
?>
I didn't get any idea. Please help me.