Use checkbox to delete multiple records at a time. Answer a friend's question: how to delete multiple records at a time. A simple example shows a student information database. you need to delete multiple records at a time and create a file named del. php. answer a friend's question: how to delete multiple records at a time.
A simple example
There is an existing 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 to ClipboardReference: [www.bkjia.com]
This file is mainly used to display and display data in the database.
Create a file named SC. php with the following code:
Copy to ClipboardReference: [www.bkjia.com] $ 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 an error occurred while deleting ";
Exit;
}
Else {
Echo "student information deleted ";
}
}
Mysql_close ();
?>
Use the foreach method to delete records respectively.
Source: http://www.cnblogs.com/walkbro/
Bytes. A simple example shows a student information database. you need to delete multiple records at a time to create a file named del. php...