php+mysql中排行榜的制作源码
时间:2007-02-17 来源:PHP爱好者
//排行榜的制作完整源代码
//其中top XX 可以自己定!输入多少就是top多少
<script language=Javascript>
function view(Url)
{
popup=window.open(Url,"Displaywindow","left=30,top=30,width=700,height=400,
toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, resizable=no");
}
</script>
<?include "config.php" ?>
<? 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;}
?>
<html>
<head>
<title>热门新闻访问排行榜</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css" type="text/css">
</head><body bgColor=#f7f2d0>
<p align=center>热门新闻访问排行榜Top<?echo $key;?></p>
<table border=1 bordercolordark="#FFFFFF" bordercolorlight="#000000" align=center>
<tr><td width=30 bgcolor=#e0e4ff>名次</td><td width=300 bgcolor=#e0e4ff>新闻标题</td>
<td bgcolor=#e0e4ff><center>类别</center></td><td bgcolor=#e0e4ff><center>人气</center>
</td></tr>
<td bgcolor="#E7F3DA"><?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)){
?>
<tr>
<?php echo "<td bgcolor=#e7f3da>$i</td><td height=20 bgcolor=#e7f3da>
<a href=javascript:view('view.php?recid=$myrow[id]'); >$myrow[title]</a></td>
<td height=20 bgcolor=#e7f3da>$myrow[type]</td>
<td height=20 bgcolor=#e7f3da>$myrow[hits]</td>" ?>
</tr>
<?php
$i++;
if ($i<=$rows){echo "";}
}
?></td> </tr></table><center><form method=post action=top.php>新闻人气排行Top
<input type=text size=8 name=key value=<?echo $key;?>><input type=submit value=确认 name=top>
<br><br><br><a href=javascript:window.close();>[关闭窗口]</a>
</center></body></html>
<?}?>
//来自我制作的新闻发布系统的新闻人气排行榜
php爱好者站 http://www.phpfans.net 为phper提供一切资讯.
//其中top XX 可以自己定!输入多少就是top多少
<script language=Javascript>
function view(Url)
{
popup=window.open(Url,"Displaywindow","left=30,top=30,width=700,height=400,
toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, resizable=no");
}
</script>
<?include "config.php" ?>
<? 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;}
?>
<html>
<head>
<title>热门新闻访问排行榜</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css" type="text/css">
</head><body bgColor=#f7f2d0>
<p align=center>热门新闻访问排行榜Top<?echo $key;?></p>
<table border=1 bordercolordark="#FFFFFF" bordercolorlight="#000000" align=center>
<tr><td width=30 bgcolor=#e0e4ff>名次</td><td width=300 bgcolor=#e0e4ff>新闻标题</td>
<td bgcolor=#e0e4ff><center>类别</center></td><td bgcolor=#e0e4ff><center>人气</center>
</td></tr>
<td bgcolor="#E7F3DA"><?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)){
?>
<tr>
<?php echo "<td bgcolor=#e7f3da>$i</td><td height=20 bgcolor=#e7f3da>
<a href=javascript:view('view.php?recid=$myrow[id]'); >$myrow[title]</a></td>
<td height=20 bgcolor=#e7f3da>$myrow[type]</td>
<td height=20 bgcolor=#e7f3da>$myrow[hits]</td>" ?>
</tr>
<?php
$i++;
if ($i<=$rows){echo "";}
}
?></td> </tr></table><center><form method=post action=top.php>新闻人气排行Top
<input type=text size=8 name=key value=<?echo $key;?>><input type=submit value=确认 name=top>
<br><br><br><a href=javascript:window.close();>[关闭窗口]</a>
</center></body></html>
<?}?>
//来自我制作的新闻发布系统的新闻人气排行榜
php爱好者站 http://www.phpfans.net 为phper提供一切资讯.
相关阅读 更多 +