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

Message board display page developed by PHP

This message board function has three pages, the message display page, the message editing page, and the message reply page. This section introduces the display page.

<?php
session_start();
header("content-type:text/html;charset=utf-8");
//連接數(shù)據(jù)庫
$link = mysqli_connect("localhost","root","root","message");
mysqli_set_charset($link,"utf8");
if (!$link) {
 die("連接失敗: " . mysqli_connect_error());
}
//連接數(shù)據(jù)庫
$SQL = "SELECT * FEOM DETAILS";//設(shè)置查詢指令
$result=mysqli_query($link,$sql);//執(zhí)行查詢
?>
<!DOCTYPE html>
<html>
<head>
    <meta  charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no" />
    <title>留言板</title>
    <style>
 .top{
            width:410px
 }
        .fl{
            float:left
 }
        .klytd {width:100px;
 text-align:left
 }
    </style>
</head>
<body>
<div style="margin:0px auto;">
 <!--頭部圖片-->
 <div>
      <img style="width:400px" src="https://img.php.cn/upload/course/000/000/007/5816db62346b9319.jpg">
 </div>
 <!--中間內(nèi)容-->
 <div>
    <div style="width:400px;" class="fl font">
       <div style="margin:0px auto;"><h2>留言列表</h2>
           <form method="post" action="list.php">
 <?php while($row=mysqli_fetch_assoc($result)):?>
 <table>
     <tr><td>留言時間:</td><td><?php echo $row['time'];?></td></tr>
       <p><button type="button" value="回復(fù)">
        <a href="reply_list.php?id=<?php echo $row['id'];?>">回復(fù)</a></button></p>
     <tr><td>留言人:</td><td><?php echo $row['name'];?></td></tr>
     <tr><td>標(biāo)題:</td><td><?php echo $row['title'];?></td></tr>
      <tr><td>內(nèi)容:</td><td><?php echo $row['content'];?></td></tr>
     <tr><td>回復(fù):</td><td><?php echo $row['reply'];?></td></tr>
 </table>
 </form>
  <br/>
  <hr>
 <?php endwhile;?>
 </div>
    <div>
       <button type="button" value="發(fā)表留言"><a href="form.html">發(fā)表留言</a></button>
    </div>
   </div>
  </div>
</body>
</html>

PHP code can be written on the same page as HTML.

The PHP code first connects to the database, and then executes the SQL query statement to display the queried data on the list page.

In the HTML page, we only need to write a loop to loop out all the queried data.

Continuing Learning
||
<?php session_start(); header("content-type:text/html;charset=utf-8"); //連接數(shù)據(jù)庫 $link = mysqli_connect("localhost","root","root","message"); mysqli_set_charset($link,"utf8"); if (!$link) { die("連接失敗: " . mysqli_connect_error()); } //連接數(shù)據(jù)庫 $SQL = "SELECT * FEOM DETAILS";//設(shè)置查詢指令 $result=mysqli_query($link,$sql);//執(zhí)行查詢 ?> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="format-detection" content="telephone=no" /> <title>留言板</title> <style> .top{ width:410px } .fl{ float:left } .klytd {width:100px; text-align:left } </style> </head> <body> <div style="margin:0px auto;" class="top"> <!--頭部圖片--> <div class="head"> <img style="width:400px" src="http://img.php.cn/upload/course/000/000/007/5816db62346b9319.jpg"> </div> <!--中間內(nèi)容--> <div class="body"> <div style="width:400px;" class="fl font"> <div style="margin:0px auto;" class="keleyitable"><h2>留言列表</h2> <form method="post" action="list.php"> <?php while($row=mysqli_fetch_assoc($result)):?> <table> <tr><td class="klytd">留言時間:</td><td class="hvttd"><?php echo $row['time'];?></td></tr> <p><button type="button" value="回復(fù)"><a href="reply_list.php?id=<?php echo $row['id'];?>">回復(fù)</a></button></p> <tr><td class="klytd">留言人:</td><td class ="hvttd"><?php echo $row['name'];?></td></tr> <tr><td class="klytd">標(biāo)題:</td><td class ="hvttd"><?php echo $row['title'];?></td></tr> <tr><td class="klytd">內(nèi)容:</td><td class ="hvttd"><?php echo $row['content'];?></td></tr> <tr><td class="klytd">回復(fù):</td><td class="hvttd"><?php echo $row['reply'];?></td></tr> </table> </form> <br/><hr> <?php endwhile;?> </div> <div> <button type="button" value="發(fā)表留言"><a href="form.html">發(fā)表留言</a></button> </div> </div> <!--底部鏈接與內(nèi)容--> <div> </div> </div> </body> </html>
submitReset Code