Php one-time deletion of front-end checkbox multi-choice content _ PHP Tutorial

Source: Internet
Author: User
Php deletes the front-end checkbox multiple-choice content at a time. The copy code is as follows: SQL: $ SQLdeletefrom 'doing' whereidin (,); data is separated by commas. Form: The copy code is as follows: formaction? Actiondoingmetho The code is as follows:


SQL: $ SQL = "delete from 'doing' where id in ('1, 2, 3, 4 ')";


Data are separated by commas.
Form:

The code is as follows:




Good $ ID_Dele = $ _ POST ['id _ Dele '] will be an array. Although PHP is of a weak type, ASP is not weak here.

ASP can be directly:
SQL = "delete from [doing] where id in ('" & ID_Dele. However, PHP cannot directly include $ ID_Dele. Because $ ID_Dele is not '1, 2, 3, 4 ', because $ ID_Dele is an array with keys and values.
Well, it's not difficult in PHP. There's just a function: implode (), right. A function is the opposite of the split () \ explode () function. The latter two are separated by a certain character (such as a comma), and the former can be spliced as a string.

Therefore:

The code is as follows:


$ ID_Dele = implode (",", $ _ POST ['id _ dele']);
$ SQL = "delete from 'doing' where id in ($ ID_Dele )";

The http://www.bkjia.com/PHPjc/313602.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/313602.htmlTechArticle code is as follows: SQL: $ SQL = "delete from 'doing' where id in ('1, 2, 3, 4 ')"; data is separated by commas. Form: The code is as follows: form action = "? Action = doing "metho...

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.