Menghapus Data Di CI
created by Sance ainul yakin
email : isthebestleonardo
Rankum 1
pageuser.php
<tbody>
<?php $no=1;foreach ($data as $v):?>
<tr>
<td><?php echo $no?></td>
<td><?php echo $v->name?></td>
<td><?php echo $v->access?></td>
<td><?php echo $v->jenkel?></td>
<td><a href="<?php echo site_url('tambah/index')?>">Add </a>|| <a href="<?php echo site_url('hapus/index').'/'.$v->id?>" >Hapus </a>|| <a href="">Edit </a></td>
</tr>
<?php $no++; endforeach?>
<tbody>
Controller/Hapus.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Hapus extends CI_Controller {
public function index($id)
{
$query=$this->hapus_model->prosesHapus($id);
//echo $this->db->affected_rows();
if($this->db->affected_rows();){echo "ok";}
else{
$this->session->set_flasdata('err',"GAGAL");
//echo "gagal";
}
}
}
email : isthebestleonardo
Rankum 1
pageuser.php
<tbody>
<?php $no=1;foreach ($data as $v):?>
<tr>
<td><?php echo $no?></td>
<td><?php echo $v->name?></td>
<td><?php echo $v->access?></td>
<td><?php echo $v->jenkel?></td>
<td><a href="<?php echo site_url('tambah/index')?>">Add </a>|| <a href="<?php echo site_url('hapus/index').'/'.$v->id?>" >Hapus </a>|| <a href="">Edit </a></td>
</tr>
<?php $no++; endforeach?>
<tbody>
Controller/Hapus.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Hapus extends CI_Controller {
public function index($id)
{
$query=$this->hapus_model->prosesHapus($id);
//echo $this->db->affected_rows();
if($this->db->affected_rows();){echo "ok";}
else{
$this->session->set_flasdata('err',"GAGAL");
//echo "gagal";
}
}
}
Hapus_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Hapus_Model extends CI_Model {
public function prosesHapus($param)
{
return $this->db->delete('tb_Login',array('id'=>$param));
}
}
Menghapus Data Di CI
Reviewed by Leo
on
15:54
Rating:
No comments