这个就是帖子的主题页 tieba3.php
;
prepare(select id,title,content from topic where id=?); $stmt->execute(array($title)); $res=$stmt->fetchall(pdo::fetch_assoc); foreach($res as $v){ echo ''.$v['content'].''; } ?> prepare(select id,reid,content from reply where reid=?); $stmt->execute(array($id2)); $res1=$stmt->fetchall(pdo::fetch_assoc); foreach($res1 as $v2){ echo $v2['content']; } ?>
提交
tieba4.php
prepare(insert into reply(reid,name,content)values(:reid,:name,:content)); $stnt->execute($_post);header(location:http://localhost/tieba3.php?id=.$_post['reid']);}?>
回复内容: 就是类似sf的一个效果 我们在帖子列表页点击某一个标题进入到这个帖子主题里面 在主题里面提交发表完回复后再点一下浏览器的后退按钮就又退回到帖子列表页了 但我做的这个效果有个bug 就是如果不提交回复点一次就能回到帖子列表页 提交回复后需要点击两次退回按钮才能退回到帖子列表页 如果在这个帖子里面提交两次回复需要点击三次退回按钮才能回到帖子列表页 这是为什么啊?
这个就是帖子的主题页 tieba3.php
;
prepare(select id,title,content from topic where id=?); $stmt->execute(array($title)); $res=$stmt->fetchall(pdo::fetch_assoc); foreach($res as $v){ echo ''.$v['content'].''; } ?> prepare(select id,reid,content from reply where reid=?); $stmt->execute(array($id2)); $res1=$stmt->fetchall(pdo::fetch_assoc); foreach($res1 as $v2){ echo $v2['content']; } ?>
提交
tieba4.php
prepare(insert into reply(reid,name,content)values(:reid,:name,:content)); $stnt->execute($_post);header(location:http://localhost/tieba3.php?id=.$_post['reid']);}?>
