当前位置:编程学习 > php >>

PHP 批量删除 sql语句

答案:首先要了解sql语句
$SQL="delete from `zhaoxi` where id in (1,2,4)";
表单大概是:
复制代码 代码如下:

<form action="" method="post">
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="1"/>
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="2"/>
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="3"/>
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="4"/>
<input type="submit"/>
</form>

php函数主要用到implode
复制代码 代码如下:

$ID_Dele= implode(",",$_POST['ID_Dele']);
$SQL="delete from `user` where id in ($ID_Dele)";

http://www.zhaoxi.net/article/6488.htm

上一个:php print EOF实现方法
下一个:phpMyAdmin 安装及问题总结

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,