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

Tutorial Forum Kecil Pembangunan PHP Lihat Butiran Catatan

Buat fail thread.php

Kami telah berjaya menerbitkan siaran itu, tetapi kandungan yang boleh kami lihat di halaman butiran forum adalah terhad. Jika anda mahu Melihat maklumat lanjut, kami memerlukan operasi terperinci lanjut

01.jpg

02.jpg

Kod adalah seperti berikut

<?php
header("Content-type:text/html;charset=utf-8");    //設(shè)置編碼
// 創(chuàng)建連接
$conn = mysqli_connect("localhost", "root", "root", "mybbs");
mysqli_set_charset($conn,'utf8'); //設(shè)定字符集
$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">
            發(fā)帖人:
 <?php
                    echo $row['author']
 ?>
 </td>
        <td>
              發(fā)帖時(shí)間:<?php echo $row['last_post_time']?>
 <span class="spa"><a href="reply.php?id=<?php echo$row['id']?>">回復(fù)</a></span>
 </td>
    </tr>
    <tr class="ind">
        <td><?php echo $row['content']?></td>
    </tr>
    <?php
    if($row['reply']==""){
 echo "<tr>
                 <td colspan='2'>暫時(shí)還沒(méi)有回復(fù)哦?。?!</td>
             </tr>";
    }else{
 echo "<tr>
                <td>回復(fù)人:".$row['reply_author']. ".".$row['reply_time']."</td>
                <td>".$row['reply']."</td>
           </tr>";
    }
 ?>
</table>
</body>
</html>

Kami mempunyai pautan balasan dalam kod yang boleh membalas siaran (kod dalam ini tutorial Tidak menggunakan rekursi, hanya boleh membalas sekali)


Meneruskan pembelajaran
||
<?php header("Content-type:text/html;charset=utf-8"); //設(shè)置編碼 // 創(chuàng)建連接 $conn = mysqli_connect("localhost", "root", "root", "mybbs"); mysqli_set_charset($conn,'utf8'); //設(shè)定字符集 $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"> 發(fā)帖人: <?php echo $row['author'] ?> </td> <td> 發(fā)帖時(shí)間:<?php echo $row['last_post_time']?> <span class="spa"><a href="reply.php?id=<?php echo$row['id']?>">回復(fù)</a></span> </td> </tr> <tr class="ind"> <td><?php echo $row['content']?></td> </tr> <?php if($row['reply']==""){ echo "<tr> <td colspan='2'>暫時(shí)還沒(méi)有回復(fù)哦?。。?lt;/td> </tr>"; }else{ echo "<tr> <td>回復(fù)人:".$row['reply_author']. ".".$row['reply_time']."</td> <td>".$row['reply']."</td> </tr>"; } ?> </table> </body> </html>