if i>50 then exit do中的50可以修改
但我们做论坛必须把帖子分页,又因为分页这个语句太复杂,我想就不讲了,等这一个弄懂了才来弄,还有一句很有用的:
<a href="show.asp?id=<%=showbbs("id")%>"><%=showbbs("title")%></a>
里面的超连接:show.asp?id=<%=showbbs("id")%>,注意:这里的超连接把帖子的id包含了,等一下在show.asp文件中就有用了。
5、show.asp
源代码:
<!--#include file="conn.asp"-->
<%id=request.querystring("id")%>
<%set show=conn.execute("select*from bbs where id="&id&"")%>
<a href="index.asp">
<b>回到首页</b></a><br><b><a href="say.asp">发表帖子</a></b><br><hr size="1">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="180">
<tr>
<td width="21%" height="22"><b>作者:</b><%=show("name")%></td>
<td width="79%" height="22"><b>主题:</b><%=show("title")%></td>
</tr>
<tr>
<td width="100%" colspan="2" height="158" valign="top"><b><br>内容:</b><%=show("body")%></td>
</tr>
</table><%set show=nothing%>
劲语句---精华语句:
id=request.querystring("id")
在讲解index.asp文件的后面已经说到:show.asp?id=<%=showbbs("id")这一句,id=request.querystring("id")就是把地址栏中的id的值读取下来,因为index.asp文件中的超连接点击后,地址栏就为http://…………/show.asp?id=数字,所以show.asp使用id=request.querystring("id")语句把数字读取下来
于是接着使用:set show=conn.execute("select*from bbs where id="&id&"") 向数据表查询id为这时读取下来的数字的帖子,即where id="&id&" 最后<%set show=nothing%>
好了,论坛就做成了,里面的精华你就去吸取!