答案:现将本人的实践结果show给大家,不足之处就是分页的方法不太好,不能显示具体的页数,可实在又没有其它更好的解决办法,只好先如此了,如果哪位有类似本论坛的分页方法,表赐教一二,二泉不胜感激!具体可访问我的个人小网站:http://web.nyist.net/~wbgwrq,不废话了,开始吧......
//表的结构如下:
//creat.sql
//简单说明:RootId 论题序数;Layer:帖子层次,缩进的依据;Orders:帖子的顺序
CREATE TABLE over_post (
id int(11) NOT NULL auto_increment,
title varchar(80) NOT NULL default '',
content text,
postat datetime NOT NULL default '0000-00-00 00:00:00',
readed int(11) NOT NULL default '0',
size int(11) NOT NULL default '0',
rootid int(11) NOT NULL default '0',
orders int(4) NOT NULL default '0',
layer int(4) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
//creat.sql End
//发表根帖,即RootId,Layer,Orders为0的帖子
//said.php
//begin
<form method="post" action="post.php">
<table width="81%" border="0" cellspacing="1" cellpadding="0" align="center">
<tr bgcolor="#66CCCC">
<td height="35" width="23%">
<div align="right">你的想法:
</div>
</td>
<td height="35" width="77%">
<input type="text" name="title" size="50" class="eq">
</td>
</tr>
<tr bgcolor="#66CCCC">
<td height="39" width="23%">
<div align="right">你的内容:
</div>
</td>
<td height="39" width="77%">
<textarea name="content" cols="50" rows="10" class="eq"></textarea>
</td>
</tr>
<tr bgcolor="#66CCCC">
<td colspan="2" height="24">
</td>
</tr>
<tr bgcolor="#66CCCC">
<td colspan="2" height="28">
<div align="center">
<input type="submit" name="said" value="先说这些">
<input type="reset" name="Submit2" value="从头再来">
</div>
</td>
</tr>
</table>
</form>
//said.php End
//帖子内容,且在本页进行跟帖
//content.php
//Begin
<?php
$result=mysql_query("select
over_post.title,over_post.content,over_post.postat,over_post.readed,over_post.rootid,over_post.la
yer,over_post.orders from over_post where over_post.id=$id");
$readed=mysql_result($result,0,"readed");
$title=mysql_result($result,0,"title");
$content=mysql_result($result,0,"content");
$date=mysql_result($result,0,"postat");
$rootid=mysql_result($result,0,"rootid");
$orders=mysql_result($result,0,"orders");
$layer=mysql_result($result,0,"layer");
?>
<table width="90%" cellspacing="1" bgcolor="red" align="center">
<tr bgcolor="#FFFFFF">
<td width="12%">发表人:</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="12%">主 题:</td>
<td colspan="5">《<?php echo $title; ?>》 <font color="666666"><i>【
Readed:<?echo"$readed";?>】 <?echo"$date";?></i></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="12%">内 容:</td>
<td colspan="5"><?php echo $content; ?></td>
</tr>
</table>
<br>
<center>
论坛发表跟帖
<form method="post" action="post.php">
<table width="78%" cellspacing="0" align="center" cellpadding="0" border="0">
<tr bgcolor="#FFFFFF">
<td height="24" width="12%">
<div align="right">题目:</div>
</td>
<td height="24" width="88%">
<input type="text" name="title" class="eq" size="50">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="63" width="12%">
<div align="right">内容:</div>
</td>
<td height="63" width="88%">
<textarea name="content" class="eq" cols="50" rows="10"></textarea>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="57" colspan="2">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="20" colspan="2">
<div align="center">
<input type="submit" n
上一个:在线短消息收发的程序,不用数据库
下一个:PHP中记录分页显示实例(转)