• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

复选数据汇总问题

php 搞代码 3年前 (2022-01-23) 17次浏览 已收录 0个评论
文章目录[隐藏]

复选框,如果我想对选择的数据进行group_concat()操作,请问怎么做呢?

回复讨论(解决方案)

$in=implode(',',$_POST['id']); //假设复选框name为id[]$sql="select id, group_concat(name) from tt where id in($in) group by id";...

谢谢jordan102大大的解答

我还想问一个问题,一般一个页面一次显示的数据都是10,20条左右,但有时候我这里需要一次选择1000条或者显示的数据要全选,然后取消不要的复选框勾勾。这种情况一般怎么样操作呢???

贴出你的代码看看

晕倒,回复了十几遍了

前台源码

<link rel="stylesheet" type="text/css" href="css/css.css" /><!---ecms -ecms -ecms <link rel="stylesheet" type="text/css" href="css/style.css" />--><style type="text/css"> * {  padding:0;  margin:0; } body {	font-family:verdana;	font-size:12px;	margin-left: 0px;	margin-top: 0px; } .content {  width:700px;  margin:20px 10px; } .content h1 {  font-family:'??';  font-size:18px;  padding-bottom:5px; } table {  width:100%; } th, td {  padding:6px 0;  text-align:center; } th {  background-color:#accdf4;  color:#ffffff; }  tr {  background-color:#FFFFFE; }  .odd {  background-color:#FFFAFF; }  .highlight {  background-color:#E0E0E0;}.STYLE3 {font-size: 14px}</style><script type="text/javascript"> //?jsclass function addClass(element, value) {  if(!element.className) {   element.className = value; //element?class,?class?value?  } else {   element.className += " "+value; //element???class??м???,??value?  } }  //л? function stripeTable() {  var tables = document.getElementsByTagName("table"); //?еtable  for(var i=0; i<tables.length; i++) {   var rows = document.getElementsByTagName("tr");   for(var j=0; j<rows.length; j++) {    if(j%2 == 0) {     addClass(rows[j], "odd"); //?Уclass?odd     //rows[j].setAttribute("class", "odd");    }   }  } }  //??? function highlightRows() {  var rows = document.getElementsByTagName("tr");  for(var i=0; i  // --列头全选框被单击---  function ChkAllClick(sonName, cbAllId){      var arrSon = document.getElementsByName(sonName);   var cbAll = document.getElementById(cbAllId);   var tempState=cbAll.checked;   for(i=0;iSKU对照表</h2><div class="content"><?PHPinclude_once ("page.class.php");include_once ("conn.php");$pageSize=10; if(empty($_GET['page'])) { $spage=1; } else { $spage=$_GET['page']; }$start=$spage*$pageSize-$pageSize;$result = mysql_query("SELECT COUNT(*) AS count FROM `sku_rule`");$row = mysql_fetch_array($result);		$total= $row['count'];$SQL = "SELECT * FROM `sku_rule` LIMIT $start , $pageSize";		$result = mysql_query($SQL);pageft($total,$pageSize,1,1,1,5);?><div id="opt">        <div id="query">                           <label></label>  					   SKU		   订单SKU                                                      </div>                </div>  <table width="49%" cellspacing="1" bgcolor="#0093C4" summary="user infomation table">   <thead>     <tr>       <th width="4%"></th>       <th width="17%" class="STYLE3">SKU</th>       <th width="27%" class="STYLE3">订单SKU</th>       <th width="32%" class="STYLE3">FNSKU</th>       <th width="20%" class="STYLE3">发货地区</th>      </tr>   </thead>   <tbody>     <?PHP  while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {  ?>     <tr>       <td>" /></td>       <td><?PHP echo $row['sku'] ?></td>       <td><?PHP echo $row['sale_sku'] ?></td>       <td><?PHP echo $row['fnsku'] ?></td>       <td><?PHP echo $row['delivery_areas'] ?></td>      </tr>     <?PHP  }  ?>   </tbody> </table></div><div class="digg"><?php echo $pagenav;?></div>

怎么csdn也不稳定 ??

分页源码,这个是我从网上下载的分页类

<?php//为了避免重复包含文件而造成错误,加了判断函数是否存在的条件:@$page = $_GET['page'];if(!function_exists('pageft')){//定义函数pageft(),三个参数的含义为://$totle:信息总数;//$displaypg:每页显示信息数,这里设置为默认是20;//$url:分页导航中的链接,除了加入不同的查询信息“page”外的部分都与这个URL相同。//   默认值本该设为本页URL(即$_SERVER["REQUEST_URI"]),但设置默认值的右边只能为常量,所以该默认值设为空字符串,在函数内部再设置为本页URL。function pageft($totle,$displaypg=20,$shownum=0,$showtext=0,$showselect=0,$showlvtao=7,$url=''){//定义几个全局变量://$page:当前页码;//$firstcount:(数据库)查询的起始项;//$pagenav:页面导航条代码,函数内部并没有将它输出;//$_SERVER:读取本页URL“$_SERVER["REQUEST_URI"]”所必须。global $page,$firstcount,$pagenav,$_SERVER;//为使函数外部可以访问这里的“$displaypg”,将它也设为全局变量。注意一个变量重新定义为全局变量后,原值被覆盖,所以这里给它重新赋值。$GLOBALS["displaypg"]=$displaypg;if(!$page) $page=1;//如果$url使用默认,即空值,则赋值为本页URL:if(!$url){ $url=$_SE<i>本文@来#源gaodai$ma#com搞$$代**码网</i><strong>搞代gaodaima码</strong>RVER["REQUEST_URI"];}//URL分析:$parse_url=parse_url($url);$url_query=$parse_url["query"]; //单独取出URL的查询字串if($url_query){//因为URL中可能包含了页码信息,我们要把它去掉,以便加入新的页码信息。//这里用到了正则表达式,请参考“PHP中的正规表达式”$url_query=ereg_replace("(^|&)page=$page","",$url_query);//将处理后的URL的查询字串替换原来的URL的查询字串:$url=str_replace($parse_url["query"],$url_query,$url);//在URL后加page查询信息,但待赋值:if($url_query) $url.="&page"; else $url.="page";}else {$url.="?page";}//页码计算:$lastpg=ceil($totle/$displaypg); //最后页,也是总页数$page=min($lastpg,$page);$prepg=$page-1; //上一页$nextpg=($page==$lastpg ? 0 : $page+1); //下一页$firstcount=($page-1)*$displaypg;//开始分页导航条代码:if ($showtext==1){$pagenav="<span class='disabled'>".($totle?($firstcount+1):0)."-".min($firstcount+$displaypg,$totle)."/$totle 记录</span><span class='disabled'>$page/$lastpg 页</span>";}else{$pagenav="";	}//如果只有一页则跳出函数:if($lastpg<=1) return false;if($prepg) $pagenav.="首页"; else $pagenav.='<span class="disabled">首页</span>';if($prepg) $pagenav.="上一页"; else $pagenav.='<span class="disabled">上一页</span>';if ($shownum==1){	$o=$showlvtao;//中间页码表总长度,为奇数	$u=ceil($o/2);//根据$o计算单侧页码宽度$u	$f=$page-$u;//根据当前页$currentPage和单侧宽度$u计算出第一页的起始数字	//str_replace('{p}',,$fn)//替换格式	if($f<0){$f=0;}//当第一页小于0时,赋值为0	$n=$lastpg;//总页数,20页	if($n<1){$n=1;}//当总数小于1时,赋值为1	if($page==1){		$pagenav.='<span class="current">1</span>';	}else{		$pagenav.="1";	}	///////////////////////////////////////	for($i=1;$i<=$o;$i++){		if($n2){			$pagenav.='...';		}		if($c==1){continue;}		if($c==$n){break;}		if($c==$page){			$pagenav.='<span class="current">'.$page.'</span>';		}else{			$pagenav.="$c";		}		if($i==$o && $c$n){break;}//当总页数小于页码表长度时		}	if($page==$n && $n!=1){		$pagenav.='<span class="current">'.$n.'</span>';	}else{		$pagenav.="$n";		}}if($nextpg) $pagenav.="下一页"; else $pagenav.='<span class="disabled">下一页</span>';if($nextpg) $pagenav.="尾页"; else $pagenav.='<span class="disabled">尾页</span>';if ($showselect==1){//下拉跳转列表,循环列出所有页码:$pagenav.="跳至\n";for($i=1;$i<=$lastpg;$i++){if($i==$page) $pagenav.="$i\n";else $pagenav.="$i\n";}$pagenav.="页";}}}?>

jordan102大大,我源码贴出来了


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:复选数据汇总问题
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址