我有一个管理系统应该回显用户帖子,但当它显示从数据库中获得的内容时,每个帖子都有两个。
代码:
$query = "SELECT posts.title, posts.post, posts.post_id, user.username, user.picture, user.rank, user.gender FROM posts JOIN user ORDER BY posts.user_id DESC ";
$data = mysqli_query($dbc, $query);
while ($row = mysqli_fetch_array($data)) {
strip_tags($post);
echo'<table class="admin">';
if(!empty($row['title'])) {
echo'<tr><td>Title:' .$row['title']. '</td></tr>';
}
if(!empty($row['post'])) {
echo '<tr><td><pre>Post:<br/><br />' . $row['post'] . '</pre></td></tr>';
}
if(!empty($row['post_id'])) {
echo'<tr><td>Post ID:' .$row['post_id']. '<a href="acp.php?action=dp&del='.$row['post_id'].'">Delete Post</a></td></tr>';
}
if(!empty($row['username'])) {
echo '<tr><td>UserName:' . $row['username'] . '</td></tr>';
}
if(!empty($row['rank'])) {
echo '<tr><td>Rank:' . $row['rank'] . '</td></tr>';
}
if(!empty($row['gender'])){
echo '<tr><td>Gender:' . $row['gender'] . '</td></tr>';
}
echo '</table><br />';
}
这是从数据库中获取内容的方式还是回显的方式?