大家帮忙看看关于分页显示的问题??
我是想判断出最后一页来。但是好象老显示错误??
<?php
$page_num = 3;
if(!isset($page_no))
{
$page_no = 1;
}
$strat_num = $page_num*($page_no-1);
$sql = "select * from addbook order by id desc limit $strat_num,$page_num";
$result = mysql_query($sql);
$rows=mysql_num_rows($result);
//以下是判断最后一页
$sql1 = "select count(*) as amount from addbook";
$result1 =mysql_query($sql1);
mysql_data_seek($result1,0);
$data = mysql_fetch_row($result1);
$amount = $data["amount"]; //这里是67行;
if($amount)
{
if($amount<$page_num)
{
$page_count = 1;
}
if($amount % $page_num)
{
$page_count = (int)($amount/$page_num)+1;
}
else
{
$page_count = $amount/$page_num;
}
}
else
{
$page_count = 0;
}
?>
执行之后,老是显示Notice: Undefined index: amount in d:\usr\www\html\phpexe\txl\index.php on line 67
好象$amount变量里面没有东西,所以$page_count = 0;
怎么会这样呢??麻烦大家帮忙看看是哪里出现问题了!thanks