【发布时间】:2019-04-21 17:02:31
【问题描述】:
我有一个页面,它连接到数据库并获取一些数据,包括标题和内容。
我使用一个 while 循环来回显这个页面内的数据,我想要做的是在下面有 2 个按钮来自数据库的每个结果,即“编辑”和“删除”按钮。问题是我不知道如何使按钮删除或编辑右列。
编辑
添加了 PHP 部分:
$sql = "SELECT * FROM posts ORDER BY date DESC, time DESC $limit";
$query = mysqli_query($conn, $sql);
<?php
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
?>
<section>
<b>Title: </b>
<p><?php echo $row['name'] ?></p><br>
<b>Content: </b><br>
<p><?php echo $row['content'] ?></p><br>
//want to have two buttons here which can be used to edit or delete the colunm that they are under it
</section>
<?php
}
【问题讨论】:
-
请发布您的实际代码,即 HTML 和 PHP 代码,CSS 在这里没有用处。
-
您要编辑或删除什么? div 中的内容,标题,两者都有?
-
@RajdeepPaul 添加了 php
-
@DCR 编辑和删除两者
-
@Potatoman,虽然解决方案非常广泛和主观,但我在下面给出了一个答案,让您开始着手解决这个问题。请检查。