每次刷新加一个数字!!!

ywqxtx 2005-07-06 09:28:47
<td>
<%
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from news where id="&request("id")
rs.open sql,conn,1,3
rs("tick")=rs("tick")+1
rs.update
rs.close
set rs=nothing
%>

<%
dim sqlp
set rs=server.createobject("adodb.recordset")
sqlp="select * from news where id="&request("id")&""
rs.open sqlp,conn,1,1
%>
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0" class="style2">
<tr><td align="center" valign="bottom"><%=rs("title")%><hr size="1" noshade color="#666666"></td>
</tr>
<tr><td align="center" valign="top"><font color="#666666">发布时间:<%=rs("adddate")%> 作者:<%=rs("addman")%> 被阅览次数:<%=rs("tick")%></font></td>


我是采取在读取数据库的时候先把数据库的数据+1在读取的。


但是感觉很苯方法,有没有精练的方法了!!

...全文
211 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ywqxtx 2005-07-07
  • 打赏
  • 举报
回复
是的 但是我现在想把语句给简练一下
jackycxg 2005-07-07
  • 打赏
  • 举报
回复
conn.execute ("update news set tick= tick+1 where id="&request("id"))
wangyingdong 2005-07-07
  • 打赏
  • 举报
回复
conn.execute ("update news set tick= tick+1 where id="&request("id"))


set rs=server.createobject("adodb.recordset")
sql="select * from news where id="&request("id")
rs.open sql,conn,1,1

文章内容 点数
ywqxtx 2005-07-07
  • 打赏
  • 举报
回复
高手请给简练一下 :)
wj021chen 2005-07-06
  • 打赏
  • 举报
回复
这方法不是刷新一次就自动加一次浏览次数么?
cuihaiqing 2005-07-06
  • 打赏
  • 举报
回复
ASP都用这种方法!!
fatmamma 2005-07-06
  • 打赏
  • 举报
回复
写数据库应该是对的吧,高手指教啊
dorryyang 2005-07-06
  • 打赏
  • 举报
回复
rs.execute("update news set tick=tick+1")
mjb001 2005-07-06
  • 打赏
  • 举报
回复
我用的方法和你一样,纯asp脚本不能实现动态的变化,除非隔几秒中刷新页面一次!还有就是写个组件!

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧