ASP取点击次数最多的

来源:百度知道 编辑:UC知道 时间:2024/06/28 20:20:36
<%
class_name="商场资讯" '文件路径
n=7'最新的12条
set rs=server.createobject("adodb.recordset")
sql="select top "&n&" id,class_id,fname,oktime,title,addtime,up,hits from article where class_name='"&class_name&"' order by id desc"
rs.open sql,conn,1,1

rs("hits")=hits + 1
rs.update

on error resume next
do while not rs.eof
%>
<div id="girl"><table width="281" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="14" height="21">·</td>
<td width="169"><a href="html/hits.asp?id=<%=rs("id")%>" target="_blank">
<%
if len(rs("title")) > 12 then
response.write left(rs(&q

sql="select top "&n&" id,class_id,fname,oktime,title,addtime,up,hits from article where class_name='"&class_name&"' order by id desc"
修改为
sql="select top "&n&" id,class_id,fname,oktime,title,addtime,up,hits from article where class_name='"&class_name&"' order by hits desc"
如果要修改为所有的话
sql="select top "&n&" id,class_id,fname,oktime,title,addtime,up,hits from article order by hits desc"

分数啊