分类广告


推荐文章

  • 没有找到任何内容!
您当前的位置:中国站长下载网络编程PHP专区 → 文章内容

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

  • 作者:佚名    来源:不详    发布时间:2006-2-26 2:01:42
  • 字体大小:
//排行榜的制作完整源代码

//其中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>



<?
}?>



//来自我制作的新闻发布系统的新闻人气排行榜
<