• 0512分页查询


    <?php
    $name = "";   查询所取到的name的值
    $fytj = "";
    if(!empty($_GET["name"]))
    {
    	$name = $_GET["name"];
    	
    	$fytj = "name={$name}";  分页查询的条件
    }
    
    
    $tj = " where AreaName like '%{$name}%' ";  把取到的name值写到查询条件中
    
    ?>
    <br />
    <div>
    <form action="test.php" method="get">
    	<div>请输入名称:
        <input type="text" name="name" value="<?php echo $name ?>" />  
        <input type="submit" value="查询" />
        </div>
    </form>
    </div>
    <br />
    
    <table width="100%" border="1" cellpadding="0" cellspacing="0">
    <tr>
    	<td>代号</td>
        <td>名称</td>
        <td>父级代号</td>
    </tr>
    <?php
    
    include("DBDA.php");    封装好的类
    include("page.class.php");  封装好的分页类
    
    $db = new DBDA();
    
    $sqlall = "select count(*) from ChinaStates".$tj;    查询总记录的条数
    $attrall = $db->Query($sqlall);
    
    $total = $attrall[0][0];
    
    $page = new Page($total,15,$fytj,true);
    
    
    $sql = "select * from ChinaStates ".$tj.$page->limit;
    $attr = $db->Query($sql);
    
    foreach($attr as $v)
    {
    	echo "<tr><td>{$v[0]}</td><td>{$v[1]}</td><td>{$v[2]}</td></tr>";
    }
    
    
    
    ?>
    </table>
    <div>
    <?php
    echo $page->fpage();
    ?>
    </div>
    

      

  • 相关阅读:
    信息收集
    beef框架使用
    网站程序CMS识别
    查找网站后台
    下载漏洞原理及利用
    后台拿webshell方法(2)
    如何学好web安全
    TIME_WAIT过多的解决方法(转)
    sudo
    keepalived+lvs子网掩码造成VIP切换故障 + vrrp_script+track_script
  • 原文地址:https://www.cnblogs.com/wcc731546227/p/5484855.html
Copyright © 2020-2023  润新知