我有以下代码,计划是显示数据库中的数据,但如果作业不再可用,则允许站点管理员删除一行。我已将“删除”放在我想要删除该行的链接的位置。我尝试过使用<a href='delete1.php?del=$row[JobID]'>Delete</a>
,但这只会在页面上引发错误。
<?php
include_once('db.php');
$result = mysqli_query($con,"SELECT * FROM Job ORDER BY JobID");
echo "<table border='1'>
<tr>
<th>Job ID</th>
<th>Job Title</th>
<th>Job Description</th>
<th>Industry</th>
<th>Job Type</th>
<th>Salary</th>
<th>County</th>
<th>Town</th>
<th>Delete</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['JobID'] . "</td>";
echo "<td>" . $row['JobTitle'] . "</td>";
echo "<td>" . $row['JobDescription'] . "</td>";
echo "<td>" . $row['Industry'] . "</td>";
echo "<td>" . $row['JobType'] . "</td>";
echo "<td>" . $row['Salary'] . "</td>";
echo "<td>" . $row['County'] . "</td>";
echo "<td>" . $row['Town'] . "</td>";
echo "<td>" . "Delete" . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>