php mysql_fetch_array() error
- by user1877823
I am getting this error while i am trying to delete a record the query is working but this line remains on the page. i want to echo "Deleted" written in the while should show up but the while loop is not working, i have tried and searched alot nothing helps!
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);
?>
How should i make the while loop work..