How to do bulk delete in PHP? Request Code
Recently doing a project, but the bulk delete has not been able to achieve the effect. I put the code below, you and Daniel help me to see, the problem is where, thank you again!
1. Bulk 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 how to delete also not, there are sometimes point cancellation can be deleted, do not know why, seeking expert answers.
------Solution--------------------
The SQL statement echo come out and see what's going on, no way to think of other solutions
------Solution--------------------
This problem is easy to solve, the $_post["chk" Print, the SQL statement printing problem solved
------Solution--------------------
Suggest you put all your code
------Solution--------------------
echo " ";
Your checkbox does not give a value.
------Solution--------------------
Click Cancel can also be deleted because this sentence to write:
ReturnDel () "/>
and the Del () function:
if (num==0) {
Alert ("Please select!");
return false;
}
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.