日韩精品中文字幕一区二区-日韩精品中文字幕一区-日韩精品中文字幕视频-日韩精品在线一区二区三区-第一页在线-第一福利视频

當前位置:首頁文章首頁 IT學院 IT技術

教你快速編寫ASP論壇

作者:  來源:  發布時間:2011-5-31 9:30:32  點擊:
--#include file="conn.asp"--> 
<b><a href="say.asp">發表帖子</a></b><br><br> 
<div align="center"> 
<center> 
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="26"> 
<tr> 
<td width="17%"><b>作者</b></td> 
<td width="83%"><b>主題</b></td> 
</tr> 
</table> 
</center> 
</div><hr size="1"> 
<%i=1 
set showbbs=conn.execute("select*from bbs order by id desc") 
do while not showbbs.eof 
%> 
<div align="center"> 
<center> 
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="20"> 
<tr> 
<td width="17%"><%=showbbs("name")%> </td> 
<td width="83%"> 
<a href="show.asp?id=<%=showbbs("id")%>"><%=showbbs("title")%></a></td> 
</tr> 
</table> 
</center> 
</div><hr size="1"> 
<%i=i+1 
if i>50 then exit do 
showbbs.movenext 
Loop 
showbbs.Close 
set showbbs=nothing 
%> 

這個文件就不一句一句的講了 
主要講精華部分: 
set showbbs=conn.execute("select*from bbs order by id desc") 
意思是:向數據庫中的bbs數據表查詢數據,并以id排順序, 
還有這么一句:<%=showbbs("name")%> 
就是顯示數據表中的name字段的數據,這里的showbbs就是set showbbs=……中的showbbs 
代碼中的i=1和i=i+1 
if i>50 then exit do 
showbbs.movenext 
Loop 
showbbs.Close 
set showbbs=nothing 

這幾句屬于循環語句,這里就不理他,理解了也不太好用,因為他只顯示50張貼子! 
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&" 
首頁 上一頁 [1] [2] [3]  下一頁 尾頁

文章評論

軟件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
主站蜘蛛池模板: 禁忌的恋爱关系一部| 金秘书为什么那样| 小娘惹电视连续剧48集剧情| 电视剧媳妇| 推普周主题班会活动记录| 逆光飞翔 电影| 白璐个人简介照片| 血芙蓉电影| 山东生活频道| 好像怎么造句 二年级| i性感美女视频| 杨金生| 电影善良的妻子| 延禧| 无内裤全透明走秀视频| 料音| 鬼迷心窍1994| 辐射避难所掉脑袋问题答案| 宇宙魔方| 张少| 保镖1983| 七令诡事录 电影| 心经般若波罗蜜多心经全文 | 非常外父| 浙江卫视今日播出节目表| 国产伦理女村支书| 共和国之恋原唱| 珠江电影制片厂| 等着我主持人| 美女全身脱光| 彭丹丹最惊艳的电影| 福音电影| 美女视频网站色| 谍影 电视剧| 祈今朝 电视剧| 电影名《走进房间》在线观看| 阿尔法变频器说明书| 女女女爱| 漂亮阿姨 李恩美演的什么电影| 荒岛大逃亡电影在线观看| 简西摩尔|