Answer a friend question: How to delete multiple records at once.
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 to ClipboardWhat to refer to: [www.bkjia.com]
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 to ClipboardWhat to refer to: [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 error occurred while deleting";
Exit
}
else{
echo "Student information has been deleted";
}
}
Mysql_close ();
?>
The records are deleted in a foreach manner, respectively.
Source: http://www.cnblogs.com/walkbro/
http://www.bkjia.com/PHPjc/364481.html www.bkjia.com true http://www.bkjia.com/PHPjc/364481.html techarticle answer a friend question: How to delete multiple records at once. A simple example existing a student information database, need to delete multiple records at once create a file named Del.php ...