//排行榜的制作完整源代碼
//其中top XX 可以自己定!輸入多少就是top多少
<? if ($top){
$query=”select count(*) as total from data”;
$result=mysql_query($query);
$message_count=mysql_result($result,0,”total”);
if ($key>$message_count) {$key=$message_count;}
?>
熱門新聞訪問排行榜Top
名次新聞標題
類別人氣
<?php
$query=”select id,detail,title,hits,type from data order by hits desc limit 0,$key”;
$result=@mysql_query($query);
$rows=@mysql_num_rows($result);
$i=1;
while($myrow=@mysql_fetch_array($result)){
?>
<?php echo "$i
$myrow[title]
$myrow[type]
$myrow[hits]” ?>
<?php
$i++;
if ($i<=$rows){echo "";}
}
?>