<?
include "conn.php";
include "head.php";
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$pagesize=5;
$url=$_SREVER["REQUEST_URI"];//获取当前的URL
$url=parse_url($url);//将URL解析成数组
$url=$url[path];//取得path;
$numq=
mysql_query("select * from `book`");
$num = mysql_num_rows($numq);//遍历数组
if($_GET[page]){ //$_GET去取url中的page参数的值,如果取到值了就赋给$pageavl
$pageval=$_GET[page];
$page=($pageval-1)*$pagesize;
$page.=',';
} // www.jb200.com
// if($num > $pagesize){
// if($pageval<=1)$pageval=1;
// echo "共 $num 条".
// "<a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页</a>";
// }
$sql="select * from book limit $page $pagesize";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
<?
}
?>
</table>
<br>
<?
//$pagesize=5;
// $url=$_SREVER["REQUEST_URI"];//获取当前的URL
// $url=parse_url($url);//将URL解析成数组
// $url=$url[path];//取得path;
// $numq=mysql_query("select * from `book`");
// $num = mysql_num_rows($numq);//遍历数组
// if($_GET[page]){ //$_GET去取url中的page参数的值,如果取到值了就赋给$pageavl
// $pageval=$_GET[page];
// $page=($pageval-1)*$pagesize;
// $page.=',';
// }
if($num > $pagesize){
if($pageval<=1)
$pageval=1;
echo "共 $num 条".
"<a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页</a>";
}
?>