PHP Development Small Forum Tutorial View Post Details
Create thread.php file
We have successfully published the post, but the content we can see on the forum details page is limited. If you want Seeing more information, we need further detailed operations


##The code is as follows
<?php
header("Content-type:text/html;charset=utf-8"); //设置编码
// 创建连接
$conn = mysqli_connect("localhost", "root", "root", "mybbs");
mysqli_set_charset($conn,'utf8'); //设定字符集
$id=$_GET['id'];
$sql="SELECT * from tiopic where id='$id'";
$que=mysqli_query($conn,$sql);
$row=mysqli_fetch_array($que);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>详情</title>
<style>
.left{
width: 170px;
}
.bg{
background-color: #B10707;
color: white;
}
.fh{
margin-left: 18px;
}
.spa{
margin-left: 25px;
}
.ind{
text-indent:2em;
}
</style>
</head>
<body>
<table width="400px" border="1" cellpadding="12" cellspacing="0" align="center">
<tr>
<td colspan="2" class="bg"><?php echo $row['title'] ?>
<span class="fh"><a style="color: white" href="forums.php">[返回]</a></span>
</td>
</tr>
<tr>
<td rowspan="2" class="left">
发帖人:
<?php
echo $row['author']
?>
</td>
<td>
发帖时间:<?php echo $row['last_post_time']?>
<span class="spa"><a href="reply.php?id=<?php echo$row['id']?>">回复</a></span>
</td>
</tr>
<tr class="ind">
<td><?php echo $row['content']?></td>
</tr>
<?php
if($row['reply']==""){
echo "<tr>
<td colspan='2'>暂时还没有回复哦!!!</td>
</tr>";
}else{
echo "<tr>
<td>回复人:".$row['reply_author']. ".".$row['reply_time']."</td>
<td>".$row['reply']."</td>
</tr>";
}
?>
</table>
</body>
</html>We have a reply link in the code that can reply to the post (the code in this tutorial Not using recursion, can only reply once)
new file
<?php
header("Content-type:text/html;charset=utf-8"); //设置编码
// 创建连接
$conn = mysqli_connect("localhost", "root", "root", "mybbs");
mysqli_set_charset($conn,'utf8'); //设定字符集
$id=$_GET['id'];
$sql="select * from tiopic where id='$id'";
$que=mysqli_query($conn,$sql);
$row=mysqli_fetch_array($que);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>详情</title>
<style>
.left{
width: 170px;
}
.bg{
background-color: #B10707;
color: white;
}
.fh{
margin-left: 18px;
}
.spa{
margin-left: 25px;
}
.ind{
text-indent:2em;
}
</style>
</head>
<body>
<table width="400px" border="1" cellpadding="12" cellspacing="0" align="center">
<tr>
<td colspan="2" class="bg"><?php echo $row['title'] ?>
<span class="fh"><a style="color: white" href="forums.php">[返回]</a></span>
</td>
</tr>
<tr>
<td rowspan="2" class="left">
发帖人:
<?php
echo $row['author']
?>
</td>
<td>
发帖时间:<?php echo $row['last_post_time']?>
<span class="spa"><a href="reply.php?id=<?php echo$row['id']?>">回复</a></span>
</td>
</tr>
<tr class="ind">
<td><?php echo $row['content']?></td>
</tr>
<?php
if($row['reply']==""){
echo "<tr>
<td colspan='2'>暂时还没有回复哦!!!</td>
</tr>";
}else{
echo "<tr>
<td>回复人:".$row['reply_author']. ".".$row['reply_time']."</td>
<td>".$row['reply']."</td>
</tr>";
}
?>
</table>
</body>
</html>
Preview
Clear
Students who have watched this course are also learning
Let's briefly talk about starting a business in PHP
Quick introduction to web front-end development
Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
Login verification and classic message board
Computer network knowledge collection
Quick Start Node.JS Full Version
The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)





![Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]](https://img.php.cn/upload/course/000/000/035/5d27fb58823dc974.jpg)










The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~ 