网站程序问题 !!!急

来源:百度知道 编辑:UC知道 时间:2024/06/09 21:25:08
源码为热门产品 按点击次数 排列
怎么改为 默认最后发布的排列呢?
<%sql="select top 15 * from hw order by hw_views "
rs.open sql
if rs.eof then
response.write "本站目前没有成交任何商品"
else
i=0
do while not rs.eof
%>
<br><img src="IMAGES/pics2/wp_main_why_q.gif" border="0">  <a href="views.asp?hw_id=<%=rs("hw_id")%>"><%=rs("hw_name")%></a><br>
<%i=i+1
if i>=4 then exit do
rs.movenext
loop
end if
rs.close
%>

把第一行的 order by hw_views 改为 order by **id desc (这个**id应该是系统自动生成的那个唯一性的ID)

<%
sql="select top 10 * from news where state=1 and id in (select distinct(newsid) as id from gbook ) order by time desc,id desc"
n=10
set rs=conn.execute(sql)
do while not rs.eof

%>
<tr><td width="320" height="23" >
<img src='images/b.gif' border=0> <span style="font-size:9pt;line-height:15pt"><a href="news.asp?id=<%=rs("id")%>" title="<%=rs("title")%>" target="_blank"><%If rs("hot")=1 Then %><font color=red><% end if %><%=left(rs("title"),12)%><%If rs("hot")=1 Then %></font><% end if %></a></span>
</td></tr>
<%
n=n-1
if n<1 then exit do
rs.movenext
loop
%>
</table&