0

i delete a row of data from this

........
<a href="delete.php?id=<? echo $rows['id']; ?>">delete</a>

delete.php

<html>
<body>
<?php
include 'recipe2db.php';

// get value of id that sent from address bar
$id=$_POST['id'];

// Delete data in mysql from row that has this id
$sql="delete from recipe where `id` = '".$id."'";
$result=mysql_query($sql);

// if successfully deleted
if($result){
echo "Deleted Successfully";
echo "<BR>";
echo "<a href='home.php'>Back to main page</a>";
}

else {
echo "ERROR (".mysql_errno()."):";
echo mysql_error();
}

// close connection
mysql_close();

?>
</body>
</html>

but, it doesn't delete well.. from the display or from the database.
is it my code ok? or have any error.. help me..

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by pritaeas
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.