Please tell me whats wrong with this? im getting error in line 17 & 21, please help.. The purpose of this program is to fetch & display the details of the user from db.
<?php
// Connect to database server
mysql_connect("localhost", "root", "") or die (mysql_error ());
// Select database
mysql_select_db("lms") or die(mysql_error());
// (Line 17) Get data from the database depending on the value of the id in the URL
$strSQL = "SELECT * FROM login WHERE id=" . $_GET["id"];
$rs = mysql_query($strSQL);
// (Line 21) Loop the recordset $rs
while($row = mysql_fetch_array($rs)) {
// Write the data of the person
echo "<dt>Name:</dt><dd>" . $row["name"] . "</dd>";
echo "<dt>Username:</dt><dd>" . $row["username"] . "</dd>";
echo "<dt>Rollno:</dt><dd>" . $row["rollno"] . "</dd>";
}
?>
the displayed error messages are:
Undefined index: id in C:\wamp\www\phploginsession\person.php on line 17
mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\phploginsession\person.php on line 21