if(isset($said)) //宣布新帖子
{
$query="insert into over_post
values(null,'$title','$content',$user_id,'$date',0,$length,$img,'','','')";
$result=mysql_query($query) or die(mysql_error());
$r=mysql_query("select max(id) from over_post");
$rootid = mysql_result($r,0)+0;
mysql_query("update over_post set rootid=$rootid where ID=$rootid")or die(mysql_error());
}
if(isset($reply)): //宣布跟帖
mysql_query("update over_post set orders=orders+1 where rootid=$rootid and orders>$orders")or
die(mysql_error());
$layer=$layer+1;
$orders=$orders+1;
$query="insert into over_post
//盘算最小rootid:注重上面的desc,与limit联合,包管拔取纪录的局限.
//假如利用asc, 在mysql_result中检索第0个,将大大毛病!
$itemsperpage=30;
$query="select distinct rootid from over_post where rootid<=$maxid1 order by rootid desc limit
$itemsperpage";
$r=mysql_query($query);
$n=mysql_num_rows($r);
if($n>0) {
$minid1=mysql_result($r,$n-1);
$query="select * from over_post where rootid<=$maxid1 and rootid>=$minid1 order by rootid