我在帮某单位做网站..遇到点问题..关于稿件排行的问题..如下..
本月排行 本年排行(本月及本年在首页显示5条信息..然后添加一个更多链接进入按作者排行)
以及按作者排行(另页显示所有作者的信息..姓名跟发稿篇数)..
样式
名次 姓名[admin] 发表篇数[NewsSL]
1 张三 发表4篇
2 李四 发表3篇
3 王五 发表2篇
4 小明 发表1篇
名次如何让它自动生成呢?是不是要加个循环?
相关代码:
<!--#include file = admin_conn.asp -->
<!--#include file = titleb.asp -->
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<!--#include file = language.asp -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type="text/css">
<!--
a:link {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited {text-decoration: none; color: #000000 }
A:hover {COLOR: green; FONT-FAMILY: "宋体,MingLiU"; TEXT-DECORATION: underline}
body {font-size: 9pt; font-family: 宋体,MingLiU, Arial;color: #000000}
TD {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000;line-height: 120%;table-layout:fixed;word-break:break-all}
p {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
input {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
body {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select {FONT-SIZE: 9PT;font-family: 宋体}
option {FONT-SIZE: 9pt;font-family: 宋体}
textarea {FONT-SIZE: 9pt;font-family: 宋体}
-->
</STYLE>
</head>
<%
set rs = Server.CreateObject("ADODB.RecordSet"

rs.Open "select * from [admin] order by id desc",conn,1,1
while not rs.eof
username=rs("user"

set rs2 = Server.CreateObject("ADODB.RecordSet"

rs2.Open "select id,adduser from [news] where adduser='"&username&"' order by id desc",conn,1,1
conn.Execute "update [admin] set [NewsSL]="&rs2.recordcount&" where user='"&username&"' "
rs2.close:set rs2=nothing
rs.movenext
wend
rs.close:set rs=nothing
%>
<body>
<div align="center">
<table border="1" cellpadding="3" width="204" id="table2" style="border-collapse: collapse" bordercolor="#C0C0C0" cellspacing="0">
<tr>
<td bgcolor="#CC6600" align="center"><b>
<font color="#FFFFFF">名 次</font></b> </td>
<td bgcolor="#CC6600" align="center"><b>
<font color="#FFFFFF">发稿人</font></b></td>
<td bgcolor="#CC6600" align="center"><b>
<font color="#FFFFFF">发表数量</font></b></td>
</tr>
<%
set rs = Server.CreateObject("ADODB.RecordSet"

rs.Open "select * from [admin] order by NewsSL desc ,id desc",conn,1,1
while not rs.eof
%>
<tr>
<td></td>
<td><%=rs("user"

%></td>
<td align=center>
<%
Response.Write ""&rs("Newssl"

&""
rs2.close:set rs2=nothing
%>
</td>
<tr>
<%
rs.movenext
wend
rs.close:set rs=nothing
%>
</table>
</div>
</body>
</html>
<%
conn.close
set conn=nothing
%>
以上只是一般的排行..但是我的最终效果是按本月以及本年排行且还有按作者排行..还有就是关于名次的问题始终没能解决..如果要加循环来实现..不知道应该加在何处..请高手帮解决下...万分感谢...
----此外----
按月和按年排行..每增加一篇或一个用户都要自动更新并显示相应数据...
代码预览效果是以下样式:
姓名 发稿数
XX 5
XX 4
........
要求的效果是..在网站首页显示为以下效果:
本月排行 本年排行
名次 姓名 发稿数 名次 姓名 发稿数
1 XX 6
2 XX 5
..........
首页本月和本年排行都只显示5条记录..其余的另页显示...显示是按作者排行...
本年排行统计这一年所有的发稿数..然后总的排名..