PHP批量删除技巧
首先要了解sql语句
$SQL="delete from `PHP100` 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)";
××××××××××××××××××××××××××××××××
implode
将数组变成字符串。
语法:
string implode(string glue, array pieces);
返回值:
字符串
函数种类:
资料处理
内容说明
本函数将数组的内容组合成一个字符串,参数 glue 是字之间的分隔符号。
使用范例
<?
$colon_separated
=
implode
(
":"
,
$array
);
echo
$colon_separated
;
?>
××××××××××××××××××××××××××××××××
全选
<script>function checkall(form, prefix, checkall) {
for(var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if(e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
e.checked = form.elements[checkall].checked;
}
}
}</script>
<form>
<input type="checkbox"
相关文档:
转自:http://www.phpq.net
准备:
1、一台安装好的 Windows 2003 服务器,并且已经安装了 IIS 6。
2、下载 windows 版的 PHP 二进制压缩包。
安装:
解压缩 PHP 二进制压缩包到 C:\php 目录下(这里假设 C: 盘是系统盘,即安装了Windows 系统的盘,如果系统盘是 D:
盘,则解压缩到 D:\php 目录下,以此类推,下 ......
$file1 = 'F:/46.gif';
$file2 = 'F:/test.txt';
$file3 = 'F:/47.gif';
$size = filesize($file1);
echo '文件大小为:'.$size;
echo "\n<br>转化为二进制 ...";
$content = file_get_contents($file1);
$content = bstr2bin($content);
$fp = fopen($file2, 'w');
fwrite($fp, $content);
fclose($fp);
......
要不出现乱码,就要保持数据库和页面的编码格式一致.我全部使用utf-8的编码.
首先页面:
1. 将文件用UE打开,将文件另存为UTF-8无BOM格式.很多编辑器都可用.
2.使用 header("content-type:text/html; charset=utf-8"); 强制转换成utf-8的编码.
也可以新建一个head.php,如下,在页面中用include( ......
代码如下:
<?php
/* 网站验证码程序
* 运行环境: PHP5.0.18 下调试通过
* 需要 gd2 图形库支持(PHP.INI中 php_gd2.dll开启)
*&nbs ......
上次继本人发布了VC编写PHP扩展之Hello World篇后,反映很强烈,大家都希望能脱离PHP菜鸟行列,这次我给大家带来PHP调用C#编写的COM+组件。 COM+组件源代码 CODE:using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Reflection; using System.Data.O ......