How to do bulk deletion in PHP?

Source: Internet
Author: User

How do you do bulk deletion in PHP? Find the Code

I've been working on a project recently, but the bulk deletion has never worked. I put the code on the following, you Daniel help me to see where the problem is, and then thank you!

1. Bulk deletion

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 how to delete also not, there are sometimes the cancellation can also delete, do not know why, ask the expert to answer.

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

The SQL statement echo out to see exactly what is being executed, not to think of other solutions

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

This problem is easy to solve, the $_post["chk"] printing, the SQL statement printing problem solved

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

I suggest you put all your code on it.

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

echo "";

Your checkbox does not give value.

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

The point of cancellation can also be deleted because this sentence is to write:

There is also the Del () function:

if (num==0) {

Alert ("Please choose!");

return false;

}

Related Article

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.