Dalam folder application ada folder models kemudian buatlah file php baru dengan nama MDaftar.php dan isilah kodingnya sebagai berikut :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class MDaftar extends CI_Model {
public function tampil() {
return $this->db->get('tb_daftar');
}
public function simpan($data) {
return $this->db->insert('tb_daftar', $data);
}
public function hapus($data)
{
$hapus = $this->db->where('id_daftar', $data);
return $this->db->delete('tb_daftar', $hapus);
}
}
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class MDaftar extends CI_Model {
public function tampil() {
return $this->db->get('tb_daftar');
}
public function simpan($data) {
return $this->db->insert('tb_daftar', $data);
}
public function hapus($data)
{
$hapus = $this->db->where('id_daftar', $data);
return $this->db->delete('tb_daftar', $hapus);
}
}
ConversionConversion EmoticonEmoticon
Note: Only a member of this blog may post a comment.