Php method for deleting multiple records at a time using checkbox _ PHP Tutorial

Source: Internet
Author: User
Php uses checkbox to delete multiple records at a time. A simple example shows a student information database. you need to delete multiple records at a time to create a file named del. php. the code for copying the file is as follows: formaction 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:

The code is as follows:




This file is mainly used to display and display data in the database.
Create a file named SC. php with the following 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 an error occurred while deleting ";
Exit;
}
Else {
Echo "student information deleted ";
}
}
Mysql_close ();
?>


Use the foreach method to delete records respectively.

Pipeline has a student information database. you need to delete multiple records at a time to create a file named del. php. the code is as follows: form action = "...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.