Home >php教程 >php手册 >php简单的分页程序第1/5页

php简单的分页程序第1/5页

WBOY
WBOYOriginal
2016-06-13 12:29:57888browse

[code]
 

 
 
用户信息总汇 
 
 
 

 
############################################################# 
###########        连接数据库                ################ 
############################################################# 
$db=mysql_connect("192.168.0.2","root","goalwe608");  //数据库,用户名,密码 
mysql_select_db("86pos",$db);   //数据库 
############# 分页 ############ 
//设定每一页显示的记录数 
$pagesize=5; 
//取得记录总数 
$res=mysql_query("select count(id) from buyer " ,$db); 
$myrow = mysql_fetch_array($res); 
$numrows=$myrow[0]; 
//计算总页数 
$pages=intval($numrows/$pagesize); 
if ($numrows%$pagesize) 
  $pages++; 
//判断页数设置与否,如无则定义为首页 
if (!isset($page)) 
  $page=1; 

//防止恶意访问 
if ($_GET

Statement:
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