我是 codeigniter 的新手。在我的视图页面中,我在一个表中显示来自数据库的数据,其中我有两个用于更新和删除的锚标记。我想通过 id 从数据库中删除特定行。
我的查看页面是
 <?php foreach($query as $row){ ?>
 <tr>
 <td><?php echo $row->name  ?></td>
  <td><?php echo $row->testi  ?></td>
  <td><?php echo anchor('textarea/delete_row', 'DELETE', 'id="$row->id"'); ?></td>
  <td><a href="#ajax-modal2" data-id="delete[]" role="button" class="Delete" data-toggle="modal" onClick="confirm_delete()"><i class="icon-trash"></i></a></td>
  </tr>
<?php } ?>
</table>
我的控制器页面是
function delete_row()
{
   $this->load->model('mod1');
   $this->mod1->row_delete();
   redirect($_SERVER['HTTP_REFERER']);  
}
我的模型页面是
 function row_delete()
  {
      $this->db->where('id', $id);
      $this->db->delete('testimonials'); 
  }
我想通过捕获相应的 id 来删除该行。请不要苛刻。谢谢你