账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    php7.0下 查询符合条件的数量
    33
    0
    <?php @session_start();?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php if($_SESSION["uid"]==""){echo "<script>alert('对不起,您还没有登陆!');window.location.href='../login.php';</script>";exit;}
    require_once('../../func/dbase.php');
    error_reporting(E_ALL ^ E_NOTICE);
    ?>
    <title>下载中心管理</title>
    <?php
      $end= 0;
      $countPage = 0;
      $count = 0;
      $page = 0;
      $result =0;
      $end = 0;
      $classid = 0;
      $page = $_GET['page'];
      if($page==''){$page=1;}
      $torul = 20;
      $start = $page * $torul - $torul;
      $id = '';
      $re = 0;
      $id = $_GET['id'];
        $key = $_POST['key'];
       $lei = $_POST['lei'];
      if($id!=''){
          $sql="select id,url from down where id=".$id;
        $result = $mysqli->query($sql);
        while($rs=mysqli_fetch_array($result)){unlink("../../down/$rs[1]");}
        $sql = "delete from down where id =".$id;
        $result = $mysqli->query($sql);
        if($re!=0){
           echo "<script>window.location =index.php?page=".$page."</script>";
        }
      }
    if($_REQUEST['act']=='delall'){
    $yy=$_REQUEST['xx'];
    for($i=0;$i<count($yy);$i++){
    $sql="select id,url from down where id=".$yy[$i];
    $result = $mysqli->query($sql);
    while($rs=mysqli_fetch_array($result)){unlink("../../down/$rs[1]");}
    $sql= "delete from down where id=".$yy[$i];
    $result = $mysqli->query($sql);}
    echo "<script>window.location.href='index.php?page=$page';</script>";
    exit;}?>
    
    <style type="text/css">
    <!--
    td {
        font-size: 12px;
    }
    -->
    </style>
    <link href="../css.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    body {
        margin-left: 0px;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
        background-color: #007EC0;
    }
    -->
    </style>
    <script language="javascript">
    function CheckAll(form)
      {
      for (var i=0;i<form.elements.length;i++)
        {
        var e = form.elements[i];
        if (e.name != 'chkall')
           e.checked = form.chkall.checked;
        }
    }
    </script>
    </head>
    <body>
    <table width="0" height="28" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td></td>
      </tr>
    </table>
    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="10" height="48"><img src="../images/44_1.jpg" width="10" height="48" alt="" /></td>
        <td background="../images/44_2.jpg"><span style="font-size:16px">下载中心管理&gt;&gt;</span></td>
        <td width="11"><img src="../images/44_4.jpg" width="11" height="48" alt="" /></td>
      </tr>
    </table>
    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="10" height="36"><img src="../images/44_5.jpg" width="10" height="36" alt="" /></td>
        <td background="../images/44_6.jpg">&nbsp;</td>
        <td width="11"><img src="../images/44_8.jpg" width="11" height="36" alt="" /></td>
      </tr>
    </table>
    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="10" height="450" background="../images/44_9.jpg">&nbsp;</td>
        <td valign="top" bgcolor="#FFFFFF">
    <form name="form1" method="post" action="index1.php">
            <table width="560" height="5" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr><td></td></tr></table>
            <table width="560" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="193" height="25">&nbsp;关键字
                  <input name="key" type="text" id="key" value="<?php echo $key?>" size="20" maxlength="30"></td>
                <td width="214" align="center"><select name="lei">
                    <option value="0">---所有分类---</option>
    <option value="1">软件</option>
    <option value="2">用户手册</option>
    <option value="3">产品图册</option>
                  </select>
                </td>
                <td width="153" valign="bottom">&nbsp;
                    <input type="submit" name="Submit" value="搜 索" style="width:60px; height:25px;"></td>
              </tr>
            </table>
          </form>
    <table width="90%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#f8f8f8" style="border:1px solid #3366dd">
      <form name="form1" action="index.php" method="post">
      <tr>
        <td width="94" height="30" align="center"  >选/否
        <input type="checkbox" id="chkall" name="chkall" value="on" onClick="CheckAll(this.form)"></td>
        <td width="555" align="left"  >&nbsp;名称</td>
        <td width="98" align="center"  >类别</td>
        <td width="101" align="center"  >时间</td>
        <td colspan="2" align="center" >操作</td>
      </tr>
       <?php
         $sql = "select id,title,left(sdate,10) sdate,lei from down";
         if($key!=''){
         $sql= $sql." and  title like '%".$key."%'";
         }
         if($lei>0){
                 $sql = $sql." and lei = ".$lei;
         }
         $sql = $sql." order by id desc";
         $sql = $sql." limit ".$start.",".$torul;
              
         $result = $mysqli->query($sql);
         while($ar=mysqli_fetch_row($result)){$count =  $ar[0];}
    
        $result = $mysqli->query($sql);
        if($count<$torul&&$count>0){$page = 1;}
    
        if(($count%$torul)==0){
            $countPage = intval($count/$torul);
        } else {
            $countPage = intval($count/$torul) +1;
        }
         if($result!=0){
            while($arr=mysqli_fetch_array($result)){
            $i++;
            if($i%2==0){$bg="#f5f5f5";}
            else{$bg="#ffffff";}?>
       <tr>
        <td width="94" height="22" align="center" bgcolor="<?php echo $bg;?>"><input type="checkbox" name="xx[]" value="<?php echo $arr[0];?>"></td>
        <td height="22" align="left" bgcolor="<?php echo $bg;?>">&nbsp;<?php echo $arr[1]?></td>
        <td height="22" align="center" bgcolor="<?php echo $bg;?>">&nbsp;
        <?php if($arr[3]==1){?>软件<?php }?>
        <?php if($arr[3]==2){?>用户手册<?php }?>
        <?php if($arr[3]==3){?>产品图册<?php }?></td>
        <td align="center" bgcolor="<?php echo $bg;?>">&nbsp;<?php echo $arr[2];?></td>
        <td width="53" height="22" align="center" bgcolor="<?php echo $bg;?>"><a href="add.php?id=<?php echo $arr[0]?>">修改</a></td>
        <td width="60" height="22" align="center" bgcolor="<?php echo $bg;?>"><a href="?id=<?php echo $arr[0]?>&page=<?php echo $page?>"  onClick="return confirm('确定删除吗?')">删除</a></td>
      </tr>
       <?php }}if($count==0){?>
      <tr>
        <td  height="300" colspan="6" align="center" bgcolor="#FFFFFF" class="zz" >暂无相关信息!</td>
      </tr>
        <?php }?>
      <tr align="center">
        <td height="25" colspan="7" bgcolor="#f7f7f7">
        <a href="?page=1">首页</a>
        <?php if($page>1){?>
        <a href="?page=<?php echo ($page - 1)?>">上一页</a><?php }?>
        - <?php echo $page?> -
        <?php if($countPage>$page){?>
        <a href="?page=<?php echo ($page+1)?>">下一页</a><?php }?>
        <a href="?page=<?php echo $countPage?>">尾页</a>    共<?php echo $countPage?>页, 共<?php echo $count?>条文章
        <input type="submit" onClick="return confirm('是否删除选择的信息?')" name="Submit2" value="删 除">
    (删除所选)
    <input name="act" type="hidden" id="act" value="delall"></td>
      </tr>
      </form>
    </table>
        </td>
        <td width="11" background="../images/44_11.jpg">&nbsp;</td>
      </tr>
    </table>
    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="10" height="26"><img src="../images/44_12.jpg" width="10" height="26" alt="" /></td>
        <td background="../images/44_13.jpg">&nbsp;</td>
        <td width="11"><img src="../images/44_15.jpg" width="11" height="26" alt="" /></td>
      </tr>
    </table>
    </body>
    </html>

    现在就是统计条数那不准,哪位大虾帮下忙
    while($ar=mysqli_fetch_row($result)){$count = $ar[0];}

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部