Phpmysql batch data deletion implementation code _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Phpmysql data batch deletion implementation code. We generally obtain the data submitted by the form. if we use checkbox [] to perform this operation, we will look at the instance below. -- Formidform1nameform1methodpostaction1inputtypecheckbox we generally obtain the data submitted by the form. if we use checkbox [] to operate it, let's look at the instance below.
-->


If ($ _ post)
{
Print_r ($ _ post );
// The input is also saved as data,
/*
Array
(
[Checkbox] => array
(
[0] => 1
[1] => 2
[2] => 3
)

[Button] => Submit
)

In this way, we only need
*/
$ Array = $ _ post ['checkbox'];
Print_r ($ array );
/*
The result is as follows:

Array
(
[0] => 1
[1] => 2
[2] => 3
)

In fact, 1, 2, and 3 are what we want. we can use SQL in to batch delete them.
*/
$ Ids = implode (',', $ array );
$ SQL = "delete from table name where id in ($ ids )";
Mysql tutorial _ query ($ SQL );

// Batch delete the data.
// This site original reprint indicated Source http://www.bKjia. c0m otherwise will be investigated!
}

Bytes. -- Form id = form1 name = form1 method = post action = 1 input type = checkbox...

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.