发布于 2014-10-07 14:57:44 | 161 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的PHP面向对象编程,程序狗速度看过来!

PHP开源脚本语言

PHP(外文名: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,入门门槛较低,易于学习,使用广泛,主要适用于Web开发领域。PHP的文件后缀名为php。


本文为大家介绍了php执行批量删除的sql语句写法,以一个表单为示例,讲解了通过表单提交id,后台组织sql进行批量删除的功能,使用了sql中的in语法,感兴趣的同学参考下.
首先要了解sql语句
$SQL="delete from `table` 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)";

 

 



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务