一个网页程序问题?

来源:百度知道 编辑:UC知道 时间:2024/07/02 22:40:40
就是论坛,我要在点击率最高的前5个帖子旁边加上"火热"字样,但我的帖子不是按点击率排序的,也就是说那5个帖子并不是连续的,要怎么判断当前帖子是否包含在那5个帖子当中?SQL语句怎么写?请教高手........

先把点击率最高的5个帖子取出来
<%
set rs=server.createobject("adodb.recordset")
rs.open "select top 5 点击率 from 您的文章表名 order by 点击率desc",conn,3,3
然后写个函数判断
function isHot(点击率)
rs.movefirst
do while not rs.eof
if 点击率=rs("点击率") '当前帖子的点击率等于最高点击率里的一个
isHot=true
exit function
else
isHot=false
end if
rs.movenext
loop
end function
%>

调用
<%
set rsarticle=server.createobject("adodb.recordset")
rsarticle.open "select * from 您的表名",conn,3,3
'打印数据
do while not rsartilce.eof
%>
<%=rsarticle("标题")%>
'调用函数判断
<% if isHot(rsarticle("点击率")) then Response.write "火热" %>
<% rsarticle.movenext
loop
rs.close
rsarticle.close
set rs=nothing
set rsartilce=nothing
%>