请告诉我这有什么问题?我在第 17 行和第 21 行遇到错误,请帮忙。这个程序的目的是从数据库中获取并显示用户的详细信息。
<?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>";
}
?>
显示的错误消息是:
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