php+mysql中排行榜的制作源碼

//排行榜的制作完整源代碼
//其中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 "";}
}
?>

新聞人氣排行Top
<input type=text size=8 name=key value=>

[關閉窗口]

//來自我制作的新聞發佈系統的新聞人氣排行榜

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *