Home > Backend Development > PHP Tutorial > PHP MSSQL paging example (refresh), mssql paging_PHP tutorial

PHP MSSQL paging example (refresh), mssql paging_PHP tutorial

WBOY
Release: 2016-07-12 08:54:47
Original
1495 people have browsed it

PHP MSSQL 分页实例(刷新),mssql分页

/*
 '页面说明:
*/

$link=mssql_connect("MYSQL2005","sa","123456") or die("db link error!".mssql_error());
mssql_select_db("edu_dzk",$link) or die("db open error!".mssql_error());
//mssql_query("set names 'utf8'");

$sqlstrcount="SELECT count(1) FROM reguser";

$page = $_GET["page"];

if(!is_numeric($page)){
 $page="1";
}

$pagesize="30";

//$sql=mysql_query($sqlstr);

//$totalnum=mysql_num_rows($sql);

$sql=mssql_query($sqlstrcount);

list($totalnum)=mssql_fetch_row($sql);

$pagecount=ceil($totalnum/$pagesize);

$offset=($page-1)*$pagesize;

$sqlstr="Select top ".($pagesize)." * from reguser where id not in (select top ".(($page-1)*$pagesize)." id from  reguser order by id desc) order by id desc";

$sql=mssql_query($sqlstr);

$result="";
while($result=mssql_fetch_array($sql)){
 echo $result["id"].'
';
}

showpageinfo2($totalnum,$pagecount,$page,"&z=".$z);
mssql_Close($link);

function showpageinfo2($totalnum,$pagecount,$page,$filster)
{
 echo "共计: $totalnum 条记录,共 $pagecount 页,当前是第 $page 页 ";

 if($page!=1)
 {
  echo "首页 ";
  echo "上一页 ";
 }

 if($page<$pagecount)
 {
  echo "下一页 ";
  echo "尾页  ";
 }

}

?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1119218.htmlTechArticlePHP MSSQL 分页实例(刷新),mssql分页 ?php /* '页面说明: */ $link=mssql_connect("MYSQL2005","sa","123456") or die("db link error!".mssql_error()); mssql_select_db("edu...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template