可能重复:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in selectPHP mysql_fetch_array()错误
我得到这个错误,而我试图删除记录的查询工作,但该行仍然在页面上。我想回显“已删除”,虽然应该显示出来,但while循环不工作,我已经尝试过并搜索了很多没有帮助!
mysql_fetch_array() expects parameter 1 to be resource, boolean given in delete.php on line 27
delete.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>
connect.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Dataentry", $con);
?>
我应该怎么做,而循环工作..
也!** SQL注入漏洞** – deceze
也!** mysql_ *功能已过时** – Petah