fetch - Fetching data from database using PHP -


i have tried fetch data priority table of elective_mgmt database.the source code given below :

<?php     $connect = mysql_connect("localhost","root","");     mysql_select_db("elective_mgmt",$connect);     $result = mysql_query($con,"select * 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 run ,it displays this:

warning: mysql_query() expects parameter 2 resource, string given in c:\xampp\htdocs\elective_management\admin_view.php on line 5  warning: mysql_fetch_array() expects parameter 1 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 resource, null given in c:\xampp\htdocs\elective_management\admin_view.php on line 28 ?> 

i didn't idea. please me.

you parameter order mysql_query incorrect. first query connection.

mysql_query("select * priority", $connect); 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -