分类:
2009-03-13 15:40:22
if($offset=="") { $offset = 0;}
$num = 5;
include"conn.php";
//$sql1="select * from tj ";
$sql1 ="select * from tj order by id desc limit $offset, $num";
echo $query1=mysql_query($sql1);
$cout_sql = "select count(*) from tj";
$cout_query = mysql_query($cout_sql);
$cout_result = mysql_fetch_array($cout_query);
$total = $cout_result[0];//总数
$page = ceil($total/$num);
$dianqian = ($offset/$num)+1;
while($row=mysql_fetch_array($query1))
{
?>
echo "现在你在第".$dianqian."页";
if($offset != 0) {
//$offset = 0;
$page_pre = $offset - $num;
echo "首页" ;
echo "前一页";
}
if(($dianqian*$num)<$total) {
$next = $offset + $num;
$moye = ($page-1)*$num;
echo "后一页";
echo "尾页";
}
?>