我是Web开发的初学者。我制作了一个简单的表格,显示了我插入到数据库中的笔记的 ID、答案和日期。我需要一个简单的脚本来显示每个笔记的删除按钮。我想知道如何获取需要删除的每一行的 id。这是我的php代码:
<html>
<body>
<?php
include '..//config.php';
$result = mysql_query("SELECT * FROM **** Order by `id` ASC");
echo "<center><table width='400' border='1'>
<tr>
<th bgcolor='#D6D6D6' >ID</th>
<th bgcolor='#D6D6D6'>Answer</th>
<th bgcolor='#D6D6D6'>Date</th>
<th bgcolor='#D6D6D6'>Preview</th>
<th bgcolor='#D6D6D6'>Delete</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td bgcolor='#3399FF' scope='col width ='10%'>" . $row['id'] . "</td>";
echo "<td width ='10%'>" . $row['answer'] . "</td>";
echo "<td bgcolor='#3399FF' scope='col width ='10%'>" . $row['date'] . " </td>";
if ($row['hidden'] > 'http://www.********/upload/upload/') {
echo "<td width ='10%'><a href =" . $row['hidden'] . "><center>View</center></a></td>"; } else {echo "<td width ='10%'>" . $row[''] . "</td>";}
echo "<td width ='10%'><a href = 'dlt.php'>Delete</a></td>";
$row_id = $row['id'];
}
echo "</tr width ='10%'>";
echo "</table></center>";
?>
</body>
</html>