For deleting the data, use the syntax as follow:
DELETE FROM name_table WHERE condition1,condition2,… As for example, we will add menu to delete the data in table edit data such as:
echo ("<td><a href=\"delete.php?id=$row[employees_number]\">Delete</a></td></tr>")
Delete menu will bring the program into delete.php file where it is used to delete the data which have been selected in the above form.
Delete.php file as follow:
<?php
mysql_connect("localhost","root","");//database connection
mysql_select_db("employees");
$id=$_REQUEST['id'];
$order = "DELETE FROM data_employees WHERE employees_number='$id'";
mysql_query($order);
header("location:edit.php");
?>

0 comments:

Post a Comment

 
Top
Blogger Template