asp在最近几天的新闻后加new图标的问题!

来源:百度知道 编辑:UC知道 时间:2024/06/20 16:41:32
图标已经加上了,只显示最近的两条,我先说明,我是一个菜鸟,希望高手们能够不吝赐教,给我指点,我只有30分,全部都给你们,万分感激。
<%
Sub newsList(ID,num,zs)
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from news where sort="&id&" order by id desc",conn,1,1
if (rs.eof and rs.bof) then
response.Write("<tr><td height=60>  暂时没有相关信息!</td></tr>")
else
i=0
do while not rs.eof
%>
<tr>
<td width="19" height="18">◇</td>
<td width="371">
<a href="newshow.asp?id=<%=rs("id")%>"><%=cutStr(rs("title"),zs)%></a>
<%
if ID>15 then
if i<2 then
%>
<img src="images/news.gif" width="28" height="11" border="0" />
<%
end if
end if
%&g

rs.open "select * from news where sort="&id&" and datediff(d,addtime,getdate())>7 order by id desc",conn,1,1
上面的7是最近7天显示new
上面这句话只是选择7天的新闻
如果要求有其它的新闻的话
那就要读取你的新闻时间,通过datediff进行对比,如果是小于7
则输出news.gif

<img src="images/news.gif" width="28" height="11" border="0" />
控制为前两条就行了