zoukankan      html  css  js  c++  java
  • 有条件的,分页查询

    <body>
    <br />
    <!--查询表格-->
    <?php
    $name="";
    $tj="";   //分页条件
    if(!empty($_GET["name"]))   //多条件查询
    {
        $name = $_GET["name"];
        $tj = " where table_name like '%{$name}%'";
    }
    ?>
    
    <form>
        关键字:
        <input  type="text" name="name" value="<?php echo $name;   ?>" />
        <input  type="submit" value="提交"/>
    </form>
    
    <!--表格部分-->
    <br />
    <table border="1" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    <td>4</td>
    <td>5</td>
    <td>6</td>
    <td>7</td>
    </tr>
    
    <?php
    
    include("./DBDA.class.php");
    include("./page.class.php");
    
    $db = new DBDA();//因自定义housedb数据库,重新定义数据库
    $ss="mysql";
    
    $sqlall = "select count(*) from innodb_index_stats ".$tj;//有条件的SQL语句
    $result = $db->query($sqlall,0,$ss);
    $total = $result[0][0];
    $page = new Page($total,5);  
    
    $sqll = "select * from innodb_index_stats ".$tj.$page->limit;//有条件的分页查询
    $attr = $db->query($sqll,0,$ss);
    foreach($attr as $v)
    {
        echo "<tr>
        <td>$v[0]</td>
        <td>$v[1]</td>
        <td>$v[2]</td>
        <td>$v[3]</td>
        <td>$v[4]</td>
        <td>$v[5]</td>
        <td>$v[6]</td>
        </tr>";    
    }
    ?>
    
    </table>
    <br />
    <div style="background-color:#0FF" align="center"><?php  echo $page->fpage();     ?></div>
    
    </body>
    </html>

  • 相关阅读:
    阿里云图片在线处理
    下载文件
    adobe acrobat dc根据模板制作PDF问题总结点
    springcloud服务进行轮询采用Ribbon
    SpringCloud-Eureka-Client 启动后自动停止
    OI模板
    化学整理
    题解 P4180 [BJWC2010]严格次小生成树
    题解 CF255D 【Mr. Bender and Square】
    题解 P1541 【乌龟棋】
  • 原文地址:https://www.cnblogs.com/wanlibingfeng/p/5485204.html
Copyright © 2011-2022 走看看