我想從數據庫獲取值的ID並使用它刪除項目。 繼承人我的代碼:從數據庫獲取ID並將其寫入URI
此代碼當前從數據庫中獲取一組記錄,其中每個記錄都有鏈接。我怎樣才能做到這一點?
<h2>List of all polls in this site:</h2>
<?php echo '<table>';?>
<table border="1">
<tr>
<th>Title</th>
<th>Text</th>
<th colspan="2">Action</th>
</tr>
<?php
foreach($polls as $polls_item){
echo "<tr>";
echo "<td>". $polls_item['title'] ."</td>";
echo "<td>". $polls_item['text'] ."</td>";
echo "<td>". anchor('user/vote/'.$polls_item->id,'Vote') ."</td>";
echo "<td>". anchor('admin/del/'.$polls_item->id,'Delete') ."</td>";
echo "</tr>";
}
?>
<?php echo anchor('admin/del/1','Delete'); ?>
</table>
告訴我你得到了什麼當你懸停在刪除鏈接.. –