header("Content-Type:text/html;charset=GB2312");
$pagesize=10;
//echo $_POST['page'];
$result = mysql_query("Select count(DISTINCT hotelname) FROM ".TBL_HOTELS);
$myrow = mysql_fetch_array($result);
$numrows=$myrow[0];
$pages=intval($numrows/$pagesize);
if ($numrows%$pagesize)
$pages++;
if (isset($_POST['page'])){
$page=intval($_POST['page']);
}
else{
//设置为第一页
$page=1;
}
$first=1;
$prev=$page-1;
$next=$page+1;
$last=$pages;
//计算记录偏移量
$offset=$pagesize*($page - 1);
//读取指定记录数
$result=mysql_query("select `hotelname` , count( * ) from ".TBL_HOTELS." GROUP BY `hotelname` order by id desc limit $offset,$pagesize");
$num = mysql_num_rows($result);
while ($row = mysql_fetch_array($result,MYSQL_NUM)) {
$hotelname[] = $row[0];
$countpeople[] = $row[1];
}
for($a=0;$a{
//$result=mysql_query("select count(title) from " . TBL_Comments ." where `title`=\"".$title[$a]."\"");
//$row = mysql_fetch_row($result);
echo "
\n";
echo "\n";
echo "\n";
echo "\n"; //rating_bar($title[$a],5); echo " | \n";
echo "
$hotelname[$a]\n"; echo " |
\n";
echo " \n";
echo " | \n";
echo "\n"; echo " 推荐人数:($countpeople[$a]) |\n"; echo "平均分: (".$count."票) | 评论数:()\n"; echo " |
\n";
}
echo "
echo "border=0>";
echo ""; echo "
|
";