我从数据库中删除数据时遇到问题,我制作了一个表格,显示注册用户的名称和密码。在他们旁边有一个删除链接。当我按下删除链接时,它给了我一个错误。
这是 viewTheUsers.php 页面
<html>
<head>
<title>the users</title>
</head>
<body>
<table width ="650" align ="center" border ="2" >
<tr>
<th width="60">User No </th>
<th>User Name </th>
<th>User Password </th>
<th>Delete User </th>
</tr>
<?php
mysql_connect("hostName","userName","password");
mysql_select_db("db_name");
$Thequery = "SELECT * FROM table_name";
$run = mysql_query($Thequery );
while($row = mysql_fetch_array($run)){
$The_id = $row[0];
$The_name = $row[1];
$The_pass = $row[2];
?>
<tr>
<td><?php echo $The_id; ?></td>
<td><?php echo $The_name; ?></td>
<td><?php echo $The_pass; ?></td>
<td><a href="delete.php?deleting=<?php echo $The_id; ?>">Delete</a></td>
</tr>
<?php }?>
</table>
</body>
</html>
这是 delete.php 页面:
<?php
mysql_connect("hostName","userName","password");
mysql_select_db("db_name");
$deleting_id = $_GET['deleting'];
$Thequery = "delete from users where id = '$deleting_id' ";
if (mysql_query($Thequery )){
echo "<script>window.open('viewTheUsers.php?deleted = user has been deleted!!!','_self')</script>";
}
?>
按摩错误说:
注意:未定义索引:删除 C:\wamp\www\delete.php 第 6 行