In PHP, how does one batch delete objects? _ PHP Tutorial

Source: Internet
Author: User
In PHP, how does one batch delete objects ?. In PHP, how does one batch delete objects? The code has recently been working on a project, but Batch deletion does not work. I pasted the code below. you guys can help me see how to batch delete the code in PHP? Code

Recently, I was working on a project, but Batch deletion never worked. I pasted the code below. you guys can help me see where the problem is. thank you again!

// 1. batch delete

If ($ _ POST ["chk"]) {

$ Sid = implode (",", $ _ POST ["chk"]);

$ Query = mysql_query ("delete from news where news_id in (". $ sid .")");

If ($ query ){

Echo "";

}

Else {

Echo "";

}

}

This method cannot be deleted. you can also delete it if you click cancel.

------ Solution --------------------

Let's echo the SQL statement to find out what the execution is, and try other solutions.

------ Solution --------------------

This problem can be easily solved by printing $ _ POST ["chk"] and printing SQL statements.

------ Solution --------------------

We recommend that you paste your code

------ Solution --------------------

Echo "";

Your checkbox does not provide value.

------ Solution --------------------

Point cancellation can also be deleted because this sentence needs to be written as follows:

There are also del () functions:

If (num = 0 ){

Alert ("Please select! ");

Return false;

}

Why? The code has recently been working on a project, but Batch deletion does not work. I pasted the code below. you guys can help me see the problem...

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.