zoukankan      html  css  js  c++  java
  • PHP分页查询的简单方法。

    <table width="100%" border="1" cellpadding="0" cellspacing="0">  首先建立一个表格
    <tr>
     <td>代号</td>
        <td>区域名称</td>
        <td>父级代号</td>
    </tr>
    <?php
    include("../DBDA.php");
    $db = new DBDA();
    include("Page.class.php");

    //求总条数
    $szong = "select count(*) from ChinaStates";
    $azong = $db->Query($szong);
    $zongshu = $azong[0][0]; //总条数

    //造分页对象
    $page = new Page($zongshu,15);

    //在SQL语句拼接分页条件
    $sql = "select * from ChinaStates ".$page->limit;
    $attr = $db->Query($sql);

    foreach($attr as $v)
    {
     echo "<tr>
     <td>{$v[0]}</td>
        <td>{$v[1]}</td>
        <td>{$v[3]}</td>
    </tr>";
    }


     //总共  页  5/100 当前  页 首页 上一页  1,2,3,4,5,6 下一页 尾页  跳转到  页

    ?>
    </table>
    <div>
    <?php
    //返回分页信息
    echo $page->fpage(4,5,6);
    ?>

  • 相关阅读:
    BZOJ3000 斯特林公式
    组合数学一些结论
    CSP2019-JS 游记(总结)
    Atcoder AGC1~10 problem list
    ioi2015hw
    NOI2017解题报告
    HNOI2021游记
    4月做题记录
    WC2021题解
    P4592 [TJOI2018]异或
  • 原文地址:https://www.cnblogs.com/qz1234/p/5598123.html
Copyright © 2011-2022 走看看