我正在显示从数据库中检索到的数据的一部分(作者和日期)。但我希望实现一种“阅读更多”,其中作者超链接到完整结果,即当我点击作者和日期时,评论会附加到它上面。我会欣赏一个例子。谢谢
<body>
<?php
session_start();
$u = $_SESSION['username'];
if(isset ($_SESSION['username']))
{
$database = "xxxx";
$Username = "username";
$Password = "password";
$con="host=localhost port=5432 dbname=$database user=$Username password=$Password";
$db=pg_connect($con) or die('connection failed');
$query = 'select a.name,p.date,p.comment from author a, post p where a.name = p.author';
$posts = pg_query($db, $query);
}
?>
<div class = "result">
<h2>Show Result</h2>
<?php
while($row=pg_fetch_assoc($posts))
{
$author=$row['a.name'];
$date=$row['p.date'];
echo "<p><a href='#'>$author:$date</a></p>";
}
?>
</div>
</body>