在list页面,已经有链接了,在新闻内容页面要接收id数据,然后打开该id新闻。
<a href="newcontent.asp.asp?ID=<%=ID%>">新闻标题</a>
newscontent页面接收id
<%
dim id
id=request.ServerVariables("id") 接收传递过来的id数据
id=int(id) 过滤一下
if id="" or isnumeric(id)=false then 如果接收的id数据不是数字,就返回
response.Redirect("newslist.asp")
end if
conn.execute "update NewsTable set NewsHits=NewsHits+1 where NewsID="&id 这个是点击次数+1
dim rs,sql
set rs=server.CreateObject("adodb.recordset")
sql="select * from NewsTable where NewsID="&id 打开新闻内容。
rs.open sql,conn,0,1
ttl=rs("NewsTitle")
acls=rs("SsClass")
acont=rs("NewsContent")
ahit=rs("NewsHits")
rs.close 关闭新闻内容
%>
基本上就是这个意思,
下面调用就可以了。
在list页面,已经有链接了,在新闻内容页面要接收id数据,然后打开该id新闻。
<a href="newcontent.asp.asp?ID=<%=ID%>新闻标题</a>
newscontent页面接收id
<%
dim id
idcode=request.ServerVariables("id") 接收传递过来的id数据
id=int(id) 过滤一下
if id="" or isnumeric(id)=false then 如果接收的id数据不是数字,就返回
response.Redirect("newslist.asp")
end if
conn.execute "update NewsTable set NewsHits=NewsHits+1 where NewsID="&id 这个是点击次数+1
dim rs,sql
set rs=server.CreateObject("adodb.recordset")
sql="select * from NewsTable where NewsID="&id 打开新闻内容。
rs.open sql,conn,0,1
ttl=rs("NewsTitle")
acls=rs("SsClass")
acont=rs("NewsContent")
ahit=rs("NewsHits")
rs.close 关闭新闻内容
%>
基本上就是这个意思,
下面调用就可以了。
你要做一个显示新闻内容的页面,showNews.asp。
语句类似
set rs=server.createobject("adodb.recordset")
sql="select * from News_Tb where ID="&request("ID")
sql=sql & " order by ID desc"
rs.open sql,conn,1,1