我正在尝试从我的数据库中删除消息行,作为大学项目的社交网站的一部分,但出现错误:严重性:通知消息:未定义的索引:在我的视图中的 id。非常感谢任何帮助!!!!
This is my method in the Model:
function delMessage($id)
{
$this->db->where(array('id' => $id));
$this->db->delete('messages');
}
This is my method in my Controller:
function delMessage($id) {
$this->messages->delMessage($id);
redirect('message');
}
And this is the code in my view:
if(!empty($messages)){
foreach($messages as $message):
$delete = $message['id'];
var_dump($message); ?>
<li><?=$message['from']?> says...: "<?=$message['message']?>"(<?=anchor("message/delMessage/$delete", 'delete')?>)</li>
<?php endforeach?>
<?php }else{ ?>
<?php echo 'No Messages to View'; }?>