<html><meta charset="utf-8"><head><title>大哥的留言系统</title></head><body><h1>欢迎来到我的世界,我久违的陌生人</h1><?phpinclude"db.php";setcookie('name','Haisen');echo"写留言<a href='writeMessage.php'>冲</a>";$sql="select * from message";echo"<table border='2'>";echo"<tr><td>id</td><td>username</td><td>title</td><td>content</td></tr>";if($results=mysqli_query($link,$sql)){while($result=mysqli_fetch_assoc($results)){echo"<tr><td>{$result['id']}</td><td>{$result['username']}</td><td><a href='getContent.php?id={$result['id']}'>{$result['title']}</a></td><td>{$result['content']}</td>";}}else{echodie(mysqli_error($link));}?></body></html>
getContent.php
<meta charset="urf-8"><?phpinclude"db.php";?><?phpif(isset($_GET['id'])){$id=$_GET['id'];$sql="select * from message where id=".$id;if($results=mysqli_query($link,$sql)){$result=mysqli_fetch_assoc($results);echo"这个人给你留言了".$result['username']."<hr>";echo"内容是".$result['content'];}else{echodie(sqli_error($link));}}