zoukankan      html  css  js  c++  java
  • php 分页

    public function rangeIndex(){
    	    $start= explode(".",$_GET['startIp']);
    		$startIp=$start[count($start)-1];
    		
    		$stop= explode(".",$_GET['stopIp']);
    		$stopIp=$stop[count($stop)-1];
    		
    		$range= explode(".",$_GET['stopIp']);
    		$rangIp=$range[count($stop)-2];
    		import('ORG.Util.Page');//导入分页类
    		//$m=M("Machine_info");
    		$m=M();
    		//$where[substring_index("ip",'.',-1)] = array(array('gt',$startIp),array('lt',$stopIp));
    		$countNum = $m->query("select count(*) from machine_info where substring_index(ip,'.',-1)>$startIp  and substring_index(ip,'.',-1)<$stopIp and  substring_index(substring_index(ip,'.',-2),'.',1) =$rangIp");
    		//$count = $m->where($where)->select();
    		
    		$count = (int)$countNum[0]["count(*)"];
    		$page=new Page($count,15);//实例化分页类 传入总记录数和每页显示的记录数
    		$show=$page->show();//分页显示输出
    		
    		
    		$result=$m->query("select * from machine_info  where substring_index(ip,'.',-1)>$startIp  and substring_index(ip,'.',-1)<$stopIp and  substring_index(substring_index(ip,'.',-2),'.',1) =$rangIp limit ".$page->firstRow.",".$page->listRows);
    		//$result = $m->where($where)->limit($page->firstRow.','.$page->listRows)->select();
    		$this->assign('result',$result);
    		$this->assign('show',$show);
    		$this->assign('startIp',$_GET['startIp']);
    		$this->assign('stopIp',$_GET['stopIp']);
    		$this->display();
    	}

  • 相关阅读:
    Codeforces 601B. Lipshitz Sequence(单调栈)
    C++11正则表达式初探
    Codeforces 1051 D.Bicolorings(DP)
    数据库规范——学习小记
    2016 NEERC, Moscow Subregional Contest K. Knights of the Old Republic(Kruskal思想)
    10.2路径
    10.1jihe
    8/9三角形
    8/9,集合的运算
    6.2收费
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199061.html
Copyright © 2011-2022 走看看