回 帖 发 新 帖 刷新版面

主题:动网论坛的程序谁熟悉帮忙看看怎么搞

想搞个本周热贴排行和今日热贴排行,怎么搞

下面这段是热门主题,按点击率排的,但按照今日和本周,我就不会了,请高手帮看看,谢谢



<%
HotTopic2()
sub HotTopic2()
 dim rs,sql,i,n,myboard,ds,tempstr
 i=0
 n=10  '社区热门话题调用个数
 sql="select top "&n&" a.topicid,a.title,a.boardid,a.postusername,a.lastpost,a.lastposttime,a.dateandtime,b.boardtype from dv_topic a,dv_board b where a.boardid<>444 and b.boardid=a.boardid order by Hits desc"
 set rs=Dvbbs.Execute(sql)
 If Not RS.Eof then
 SQL=Rs.GetRows(-1)
 else
 response.write "目前没有新贴"
 exit sub
     end if
     rs.close:set rs=nothing
 For i=0 To Ubound(SQL,2)
 response.write "<table cellSpacing=0 cellPadding=5 border=0 width=335>" 
 response.write "<tr><td width=75% align=left><FONT class=f7>●</FONT> <a href=dispbbs.asp?boardid="&sql(2,i)&"&id="&sql(0,i)&" title=标题:"&left(sql(1,i),30)&"&#13;&#10;作者:"&left(sql(3,i),16)&"&#13;&#10;时间:"&left(sql(5,i),16)&" target=""_blank"">"
 response.write ""&left(sql(1,i),20)&"</a></td><td width=25% align=right>"&left(sql(6,i),10)&"</td></tr></TABLE>" 
 next
end sub
%>

回复列表 (共3个回复)

沙发

今日热贴排行

在原有sql语句的where中加入: DateDiff('d',时间字段,now())=0

本周热贴排行

在原有sql语句的where中加入: DateDiff('ww',时间字段,now())=0

板凳


关键是这个时间字段我不懂,没找到在什么地方,我是初次接触SQL程序,感觉跟ACCESS不一样,找不到字段在哪,你能帮我指点指点吗,非常感谢

3 楼


所谓的时间字段,就是你数据表中储存时间的字段



我来回复

您尚未登录,请登录后再回复。点此登录或注册