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"
相关文档:
问题一:cacti如法正常登录,没有报PHP程序错误
解决过程解决过程:开启PHP报错显示(在调试时,一直卡在这儿,由于是服务器上,没有开启报错程序)display_errors = On
发现报Warning: session_start() [ ......
$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);
......
EClipse for PHP 中文乱码问题
UTF-8 格式的php,中文都是乱码.
如果此时在EClipse中输入中文会有 CP1252 错误( CP1252不支持xxxx )
解决方法:
windows->preferences->general 打开点击workspace 此时右侧出现text file encoding就是文本编码 default cp1252 点击other 下拉菜单 选择UTF-8 选择即可编译 ......
$xml = '../data/news.xml' ;
$qp = qp($xml, 'news_root')->children();
$arrData = array() ;
$i = 0 ;
foreach( $qp as $child )
{
print_r( $arrData );
echo "<br/>hi<br/>";
unset($arrSub);
$arrSub = array() ;
array_push( $arrData , &$arrSub );
print_r( $arrData ......