dsadsadsa1231 2017-11-16 13:11
浏览 50

无法删除CodeIgniter中面临致命错误的数据

fetch_view.php This is my fetch_view.php file through this file I am showing my html.

<?php
    foreach ($h->result() as $row)
    { ?>
    <tr>    
        <td><?php echo $row->fname; ?></td>
        <td><?php echo $row->lname; ?></td>
        <td><?php echo $row->email; ?></td>
        <td><?php echo $row->mobile; ?></td>
        <td><?php echo $row->message; ?></td>
        <td><a href="<?= site_url('home/form').'/'.$row->id ?>">Edit</a></td>

        <td><a href="<?= site_url('home/delete').'/'.$row->id ?>">Delete</a></td>
    </tr>
<?php } ?>

select.php This is my model in this task.

public function deleteuser($id)     
{  
     $this->load->database();
     $this->db->where('id', $id);
     $this->db->delete('student');
     return true;
}


**home.php**

Controller function, In this file I am making a delete function. enter image description here, I have attached screenshot when I tried to delete data I am facing that error.

public function delete()  
{
     $this->load->model('select');
     $id=$this->input->get('id');
     if($this->select->deleteuser($id))
     {
         $data['data']=$this->select->getuser();
         $this->load->view('fetch_view', $data);
     } 
}
  • 写回答

1条回答 默认 最新

  • dongluanan7163 2017-11-16 13:35
    关注

    Everything is working fine but you don't have a getuser() function defined in your model 'select'.

    Note: When creating a model Please give name ending with "..._m" like "select_m" you will confuse about it later when your project will get larger.

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line