A simple example
Existing student information database, need to delete more than one record at a time
Create a file named del.php
The code is as follows:
Copy the Code code as follows:
This file is mainly used to display the data in the database and show it.
Then create a file named Sc.php, where the code is as follows:
Copy the Code code as follows:
$link =mysql_connect ("localhost", "root", "");
mysql_select_db ("Zs");
$id =$_post[' de ';
foreach ($id as $ide) {
$exec = "Delete from student where sid= $ide";
$result =mysql_query ($exec);
if ((Mysql_affected_rows () ==0) or (mysql_affected_rows==-1))
{
echo "No record found, or error occurred while deleting";
Exit
}
else{
echo "Student information has been deleted";
}
}
Mysql_close ();
?>
The records are deleted in a foreach manner, respectively.
The above describes the checkbox php with a checkbox to delete multiple records at a time, including the contents of the checkbox, I hope that the PHP tutorial interested in a friend helpful.