A simple example
There is a student information database and multiple records need to be deleted at one time
Create a file named del.php
The code is as follows:
Copy the codeThe code is as follows:
Copy the code The code is 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 while deleting";
exit;
}
else{
echo "Student information has been deleted";
}
}
mysql_close();
?>
The above introduces the checkbox php method of using checkbox to delete multiple records at one time, including the checkbox content. I hope it will be helpful to friends who are interested in PHP tutorials.