我在尝试删除查询正在工作的记录时收到此错误,但此行仍保留在页面上。我想回显写在 while 中的“已删除”应该出现,但 while 循环不起作用,我已经尝试并搜索了很多没有任何帮助!
mysql_fetch_array() expects parameter 1 to be resource, boolean given in delete.php on line 27
删除.php
<html>
<body>
<form method="post">
Id : <input type="text" name="id">
Name : <input type="text" name="name">
Description : <input type="text" name="des">
<input type="submit" value="delete" name="delete">
</form>
<?php
include("connect.php");
$id = $_POST['id'];
$name = $_POST['name'];
$des = $_POST['des'];
$result = mysql_query("DELETE FROM fact WHERE id='$id'") or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo "Deleted";
}
mysql_close($con); ?>
</body>
</html>
连接.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Dataentry", $con);
?>
我应该如何使while循环工作..