亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP development small forum tutorial reply-2

This page stores the data passed from the reply page into the database

6.jpg

The code is as follows

<?php
header("Content-type:text/html;charset=utf-8");    //設(shè)置編碼
$id=$_GET['id'];
$reply_author=$_POST['reply_author'];
$reply=$_POST['reply'];
$reply_time=date("Y-m-d H:i:s");
// 創(chuàng)建連接
$conn = mysqli_connect("localhost", "root", "root", "mybbs");
mysqli_set_charset($conn,'utf8'); //設(shè)定字符集

$sql="update tiopic set reply_author='$reply_author',reply='$reply',reply_time='$reply_time' WHERE id='$id'";
$que=mysqli_query($conn,$sql);
if($que){
    echo "<script>alert('回復(fù)成功');location.href='thread.php?id=1';</script>";
}else{
    echo "<script>alert('你的回復(fù)好像有點(diǎn)小問(wèn)題.....');location.href='thread.php';</script>";
}
?>

Now If we reply successfully, there will be reply information on our post details page

1.jpg


Now we have completed the basic functions of the forum

The following Let’s organize our code


Continuing Learning
||
<?php header("Content-type:text/html;charset=utf-8"); //設(shè)置編碼 $id=$_GET['id']; $reply_author=$_POST['reply_author']; $reply=$_POST['reply']; $reply_time=date("Y-m-d H:i:s"); // 創(chuàng)建連接 $conn = mysqli_connect("localhost", "root", "root", "mybbs"); mysqli_set_charset($conn,'utf8'); //設(shè)定字符集 $sql="update tiopic set reply_author='$reply_author',reply='$reply',reply_time='$reply_time' WHERE id='$id'"; $que=mysqli_query($conn,$sql); if($que){ echo "<script>alert('回復(fù)成功');location.href='thread.php?id=1';</script>"; }else{ echo "<script>alert('你的回復(fù)好像有點(diǎn)小問(wèn)題.....');location.href='thread.php';</script>"; } ?>
submitReset Code