Menampilkan Menambah Menghapus Mengedit Data dengan CodeIgniter

Data Manipulation Language merupakan bahasa dalam pemrograman untuk menambah, menghapus, menampilkan, dan modifikasi data di database.

Persiapan Database

Buat database dengan nama dmlci di localhost/phpmyadmin, dengan cara mengetik perintah sql di bawah


CREATE DATABASE dmlci

Buat table berita di database dmlci dengan perintah sql di bawah :

CREATE TABLE berita (
        id int(11) NOT NULL AUTO_INCREMENT,
        judul varchar(128) NOT NULL,
        slug varchar(128) NOT NULL,
        isi text NOT NULL,
        PRIMARY KEY (id),
        KEY slug (slug)
);

Isi Tabel Berita dengan perintah sql sebagai berikut :

INSERT INTO `berita` (`id`, `judul`, `slug`, `isi`) 
VALUES 
(NULL, 'Judul Pertama', 'Judul-Pertama', 'Isi Judul Pertama'),
(NULL, 'Judul Kedua', 'Judul-Kedua', 'Isi Judul Kedua');

Persiapan CodeIgniter

Copykan folder codeigniter ke folder htdocs di xampp, rename jadi dmlbuku

Koneksikan database dmlci dengan codeigniter dengan cara mengedit file database.php di folder application/config/ menjadi seperti di bawah :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); $active_group = 'default'; $query_builder = TRUE; $db['default'] = array( 'dsn' => '',
	'hostname' => 'localhost',
	'username' => 'root',
	'password' => '',
	'database' => 'dmlci',
	'dbdriver' => 'mysqli',
	'dbprefix' => '',
	'pconnect' => FALSE,
	'db_debug' => (ENVIRONMENT !== 'production'),
	'cache_on' => FALSE,
	'cachedir' => '',
	'char_set' => 'utf8',
	'dbcollat' => 'utf8_general_ci',
	'swap_pre' => '',
	'encrypt' => FALSE,
	'compress' => FALSE,
	'stricton' => FALSE,
	'failover' => array(),
	'save_queries' => TRUE
);

Edit file config.php di folder application/config, cari code :

$config['base_url'] = $root;

ubah menjadi

$config['base_url'] = 'http://localhost/dmlci';

cari juga code di bawah di file config.php :

$config['index_page'] = 'index.php';

ubah menjadi

$config['index_page'] = '';

Code config.php selengkapnya menjadi seperti di bawah :

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = 'http://localhost/dmlci';

$config['index_page'] = 'index.php';
$config['uri_protocol']	= 'REQUEST_URI';
$config['url_suffix'] = '';
$config['language']	= 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FALSE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['allow_get_array'] = TRUE;
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0644;
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['error_views_path'] = '';
$config['cache_path'] = '';
$config['cache_query_string'] = FALSE;
$config['encryption_key'] = '';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix']	= '';
$config['cookie_domain']	= '';
$config['cookie_path']		= '/';
$config['cookie_secure']	= FALSE;
$config['cookie_httponly'] 	= FALSE;
$config['standardize_newlines'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';

Buat file .htaccess di foleder htdocs/dmlci dan codenya seperti di bawah :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Edit file routes.php yang berada di folder application/config, untuk code berikut :

$route['default_controller'] = 'welcome';

menjadi seperti ini :

$route['default_controller'] = 'berita';

code full dari routes.php menjadi seperti di bawah :

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$route['default_controller'] = 'berita';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

Menampilkan Data

1. Model
Buat file M_berita.php di folder application/models dengan kode seperti di bawah ini :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class M_berita extends CI_Model{ public function __construct() { parent::__construct(); $this->load->database();
    //Codeigniter : Write Less Do More
  }
  public function tampilkanberita()
  {
    $query=$this->db->get('berita');
    return $query->result_array();
    }

}

2. controller
Buat file Berita.php di folder application/controllers dengan kode berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Berita extends CI_Controller{ public function __construct() { parent::__construct(); $this->load->model('m_berita');
    $this->load->helper('url');
    $this->load->library('form_validation');
  }

  public function index()
  {
    $data['title']='Judul';
    $data['berita'] = $this->m_berita->tampilkanberita();
    $this->load->view('v_berita',$data);
  }

}

3. view
Buat file v_berita.php di folder application/view dengan kode program seperti di bawah :

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title><?php echo $title; ?></title>
  </head>
  <body>
    <?php foreach ($berita as $isiberita):?>




<h1><?php echo $isiberita['judul']; ?></h1>




<?php echo $isiberita['isi']; ?>


  <?php endforeach; ?>
  </body>
</html>

Menampilkan Data Single

1. model
Buat fungsi tampilkansingle di file M_berita.php di folder application/models dengan kode berikut :

function tampilkansingle($where){
     $query=$this->db->get_where('berita',$where);
     return $query->result_array();
	}

Jadi Full code untuk M_berita.php sebagai berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class M_berita extends CI_Model{ public function __construct() { parent::__construct(); $this->load->database();
    //Codeigniter : Write Less Do More
  }
  public function tampilkanberita()
  {
    $query=$this->db->get('berita');
    return $query->result_array();
  }
  function tampilkansingle($where){
		 $query=$this->db->get_where('berita',$where);
     return $query->result_array();
	}

}

2. Controller
Buat fungsi singleberita() di file Berita.php di folder application/controllers dengan kode sebagai berikut :

public function singleberita($slug)
  {
    $where = array('slug' => $slug);
    $data['berita'] = $this->m_berita->tampilkansingle($where);
    $data['title']=$slug;
    $this->load->view('v_single',$data);

  }

Full code dari Berita.php sebagai berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Berita extends CI_Controller{ public function __construct() { parent::__construct(); $this->load->model('m_berita');
    $this->load->helper('url');
    $this->load->library('form_validation');
  }

  public function index()
  {
    $data['title']='Judul';
    $data['berita'] = $this->m_berita->tampilkanberita();
    $this->load->view('v_berita',$data);
  }
  public function singleberita($slug)
  {
    $where = array('slug' => $slug);
    $data['berita'] = $this->m_berita->tampilkansingle($where);
    $data['title']=$slug;
    $this->load->view('v_single',$data);

  }
}

3. View
Buat file v_single.php di folder application/views dengan kode seperti berikut :

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title><?php echo $title; ?></title>
  </head>
  <body>
    <?php foreach ($berita as $itemberita):?>

<h1><?php echo $itemberita['judul']; ?></h1>



<?php echo $itemberita['isi']; ?>

    <?php endforeach; ?>

  </body>
</html>

Merapikan Tampilan Home dan Single

Controller
Edit file Berita.php di folder application/controller menjadi seperti di bawah :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Berita extends CI_Controller{ public function __construct() { parent::__construct(); $this->load->model('m_berita');
    $this->load->helper('url');
    $this->load->library('form_validation');
  }

  public function index()
  {
    $data['title']='Judul';
    $data['berita'] = $this->m_berita->tampilkanberita();
    $this->load->view('header',$data);
    $this->load->view('v_berita',$data);
    $this->load->view('footer',$data);
  }
  public function singleberita($slug)
  {
    $where = array('slug' => $slug);
    $data['berita'] = $this->m_berita->tampilkansingle($where);
    $data['title']=$slug;
    $this->load->view('header',$data);
    $this->load->view('v_single',$data);
    $this->load->view('footer',$data);

  }
}

CSS
Buat folder assets di folder dmlci, kemuadian buat file style.css di folder dmlci/assets dan isi kode sebagai berikut :

*{
	margin:0; padding:0;
	font-family:sans-serif;
}
body{
	margin:40px;auto;
	width:90%;
}
h1{
	margin-bottom:30px;
}
#menu{
	margin:10px 0px 0px 15px;
}
#menu a{
	color:black;
}
.each_article{
	background-color:rgb(160,171,171);
	color:white;
	padding:5px;
	margin:5px;
}

}
#judul_single{
	font-size:25px;
	font-weight:bold;

}
#konten_single{
	margin:10px 0 15px 0;

}


footer{
	margin-top:30px;
  text-align: center;
}

View
Buat file header.php di application/views dengan kode sebagai berikut :

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="<?php echo base_url('assets/style.css') ?>">
    <title><?php echo $title; ?></title>
  </head>
  <body>

<h1>TrisnoWlaharWetan.Net</h1>


<div class="menu">
      <a href="<?php echo base_url() ?>">Home</a>

    </div>


Buat file footer.php di applcaiton/views dengan kode sebagai berikut :


<footer>copy right @Trisnowlaharwetan</footer>

</body>
</html>

Edit file v_berita.php di application/views menjadi kode sebagai berikut :


    <?php foreach ($berita as $isiberita):?>


<div class="each_article">

<h3><a href="<?php echo base_url('berita/singleberita/').$isiberita['slug'] ?>"><?php echo $isiberita['judul']; ?></a></h3>



<?php echo $isiberita['isi']; ?>

</div>

  <?php endforeach; ?>

Edit file v_single.php di application/views menjadi kode sebagai berikut :


    <?php foreach ($berita as $itemberita):?>

<div class="judul_single">

<h3><?php echo $itemberita['judul']; ?></h3>

      </div>


<div class="konten_single">


<?php echo $itemberita['isi']; ?>

  
      </div>



    <?php endforeach; ?>

Menambah Data

1. Model
Edit file M_berita.php di folder application/models dan tambahkan sebuah fungsi tambahberita() dengan kode seperti di bawah :

public function tambahberita($data)
  {
    $this->db->insert('berita',$data);
  }

Full kode M_berita.php sebagai berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class M_berita extends CI_Model{ public function __construct() { parent::__construct(); $this->load->database();
    //Codeigniter : Write Less Do More
  }
  public function tampilkanberita()
  {
    $query=$this->db->get('berita');
    return $query->result_array();
  }
  public function tampilkansingle($where){
		 $query=$this->db->get_where('berita',$where);
     return $query->result_array();
	}
  public function tambahberita($data)
  {
    $this->db->insert('berita',$data);
  }

}

2. Controller
Buka file Berita.php di folder application/controller, dan tambahkan kode / fungsi dengan detail sebagai berikut :

public function tambahberita()
  {
    $data['title']='Tambah Berita';
    $this->load->view('header',$data);
    $this->load->view('tambahberita');
    $this->load->view('footer');
  }
  public function aksitambahberita()
  {
    //Tangkap data dari forom
    $judul = $this->input->post('judul');
    $slug=str_replace(' ','-',$judul);
    $isiberita=$this->input->post('isiberita');


    //Form Validasi jika kosong
    $this->form_validation->set_rules('judul', 'Judul', 'required');
    $this->form_validation->set_rules('isiberita', 'Isi Berita', 'required');
    if($this->form_validation->run()!=false)
    {
      $data=array(
        'judul'=>$judul,
        'isi'=>$isiberita,
        'slug'=>$slug
      );
      $this->m_berita->tambahberita($data);
      redirect(base_url());

    }
    else {
      $data['title']='Tambah Berita';
      $this->load->view('header',$data);
      $this->load->view('tambahberita');
      $this->load->view('footer');
    }
  }

Full kode dari Berita.php sebagai berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Berita extends CI_Controller{ public function __construct() { parent::__construct(); $this->load->model('m_berita');
    $this->load->helper('url');
    $this->load->library('form_validation');
  }

  public function index()
  {
    $data['title']='Judul';
    $data['berita'] = $this->m_berita->tampilkanberita();
    $this->load->view('header',$data);
    $this->load->view('v_berita',$data);
    $this->load->view('footer',$data);
  }
  public function singleberita($slug)
  {
    $where = array('slug' => $slug);
    $data['berita'] = $this->m_berita->tampilkansingle($where);
    $data['title']=str_replace('-',' ',$slug);
    $this->load->view('header',$data);
    $this->load->view('v_single',$data);
    $this->load->view('footer',$data);

  }
  public function tambahberita()
  {
    $data['title']='Tambah Berita';
    $this->load->view('header',$data);
    $this->load->view('tambahberita');
    $this->load->view('footer');
  }
  public function aksitambahberita()
  {
    //Tangkap data dari forom
    $judul = $this->input->post('judul');
    $slug=str_replace(' ','-',$judul);
    $isiberita=$this->input->post('isiberita');


    //Form Validasi jika kosong
    $this->form_validation->set_rules('judul', 'Judul', 'required');
    $this->form_validation->set_rules('isiberita', 'Isi Berita', 'required');
    if($this->form_validation->run()!=false)
    {
      $data=array(
        'judul'=>$judul,
        'isi'=>$isiberita,
        'slug'=>$slug
      );
      $this->m_berita->tambahberita($data);
      redirect(base_url());

    }
    else {
      $data['title']='Tambah Berita';
      $this->load->view('header',$data);
      $this->load->view('tambahberita');
      $this->load->view('footer');
    }
  }
}

3. View
Buat file tambahberita.php di folder application/views dengan kode sebagai berikut :

<?php echo validation_errors(); ?>

<form class="" action="<?php echo base_url('berita/aksitambahberita') ?>" method="post">
<label for="">Judul</label>
<input type="text" name="judul" value="">
<label for="">Isi Berita</label>
<textarea name="isiberita" rows="8" cols="80"></textarea>
<input type="submit" name="submit" value="Proses">
</form>


Tambahkan kode berikut pada file header.php pada folder application/views :

<a href="<?php echo base_url('berita/tambahberita/') ?>">Tambah</a>

Full code untuk header.php sebagai berikut :

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="<?php echo base_url('assets/style.css') ?>">
    <title><?php echo $title; ?></title>
  </head>
  <body>

<h1>TrisnoWlaharWetan.Net</h1>


<div class="menu">
      <a href="<?php echo base_url() ?>">Home</a>
      <a href="<?php echo base_url('berita/tambahberita/') ?>">Tambah</a>

    </div>


Menghapus Data

1. Model
Edit file M_berita.php di folder application/models dan tambahkan fungsi hapusdata dengan kode sebagai berikut :

function hapusberita($where){
		$this->db->where($where);
		$this->db->delete('berita');
	}

Full kode M_berita.php setelah ditambah kode diatas menjadi sebagai berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class M_berita extends CI_Model{ public function __construct() { parent::__construct(); $this->load->database();
    //Codeigniter : Write Less Do More
  }
  public function tampilkanberita()
  {
    $query=$this->db->get('berita');
    return $query->result_array();
  }
  public function tampilkansingle($where){
		 $query=$this->db->get_where('berita',$where);
     return $query->result_array();
	}
  public function tambahberita($data)
  {
    $this->db->insert('berita',$data);
  }
  function hapusberita($where){
		$this->db->where($where);
		$this->db->delete('berita');
	}

}

2. Controller
Edit file Berita.php dan tambahkan fungsi hapusberita() dengan kode sebagai berikut :

public function hapusberita($slug)
  {
    $where = array('slug' => $slug);
		$this->m_berita->hapusberita($where);
    redirect(base_url());
  }

3. View
Edit file v_berita.php di folder application/views dengan kode sebagai berikut :

<a href="<?php echo base_url('berita/hapusberita/').$isiberita['slug'] ?>">Hapus</a>

Full kode dari v_berita.php setelah kode penambahan kode di atas adalah sebagai berikut :


    <?php foreach ($berita as $isiberita):?>


<div class="each_article">

<h3><a href="<?php echo base_url('berita/singleberita/').$isiberita['slug'] ?>"><?php echo $isiberita['judul']; ?></a></h3>



<?php echo $isiberita['isi']; ?>
    <a href="<?php echo base_url('berita/hapusberita/').$isiberita['slug'] ?>">Hapus</a>
    

</div>

  <?php endforeach; ?>

Mengedit Data

1. Model
Tambahkan fungsi updateberita() di file M_berita.php yang terletak di folder application/models dengan kode sebagai berikut :

function updateberita($where,$data){
		$this->db->where($where);
		$this->db->update('berita',$data);
	}

Full code dari file M_berita.php sesudah ditambahkan fungsi di atas adalah sebagai berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class M_berita extends CI_Model{ public function __construct() { parent::__construct(); $this->load->database();
    //Codeigniter : Write Less Do More
  }
  public function tampilkanberita()
  {
    $query=$this->db->get('berita');
    return $query->result_array();
  }
  public function tampilkansingle($where){
		 $query=$this->db->get_where('berita',$where);
     return $query->result_array();
	}
  public function tambahberita($data)
  {
    $this->db->insert('berita',$data);
  }
  function hapusberita($where){
		$this->db->where($where);
		$this->db->delete('berita');
	}
  function updateberita($where,$data){
		$this->db->where($where);
		$this->db->update('berita',$data);
	}

}

2. Controller

Buat fungsi editberita() dan fungsi aksieditberita() dan tambahkan pada file Berita.php di folder application/controller dengan kode sebagai berikut :

public function editberita($slug)
  {
    $where = array('slug' => $slug);
    $data['berita'] = $this->m_berita->tampilkansingle($where);
    $data['title']='Edit '.str_replace('-',' ',$slug);
    $this->load->view('header',$data);
    $this->load->view('editberita',$data);
    $this->load->view('footer',$data);
  }
  public function aksieditberita($slug)
  {
    //Tangkap data dari forom
    $where = array('slug' => $slug);
    $judul = $this->input->post('judul');
    $slug=str_replace(' ','-',$judul);
    $isiberita=$this->input->post('isiberita');


    //Form Validasi jika kosong
    $this->form_validation->set_rules('judul', 'Judul', 'required');
    $this->form_validation->set_rules('isiberita', 'Isi Berita', 'required');
    if($this->form_validation->run()!=false)
    {
      $data=array(
        'judul'=>$judul,
        'isi'=>$isiberita,
        'slug'=>$slug
      );
      $this->m_berita->updateberita($where,$data);
      redirect(base_url());

    }
    else {
      $data['title']='Tambah Berita';
      $this->load->view('header',$data);
      $this->load->view('tambahberita');
      $this->load->view('footer');
    }
  }

Full kode dari file Berita.php setelah ditambahkan fungsi tersebut di atas sebagai berikut :

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Berita extends CI_Controller{ public function __construct() { parent::__construct(); $this->load->model('m_berita');
    $this->load->helper('url');
    $this->load->library('form_validation');
  }

  public function index()
  {
    $data['title']='Judul';
    $data['berita'] = $this->m_berita->tampilkanberita();
    $this->load->view('header',$data);
    $this->load->view('v_berita',$data);
    $this->load->view('footer',$data);
  }
  public function singleberita($slug)
  {
    $where = array('slug' => $slug);
    $data['berita'] = $this->m_berita->tampilkansingle($where);
    $data['title']=str_replace('-',' ',$slug);
    $this->load->view('header',$data);
    $this->load->view('v_single',$data);
    $this->load->view('footer',$data);

  }
  public function tambahberita()
  {
    $data['title']='Tambah Berita';
    $this->load->view('header',$data);
    $this->load->view('tambahberita');
    $this->load->view('footer');
  }
  public function aksitambahberita()
  {
    //Tangkap data dari forom
    $judul = $this->input->post('judul');
    $slug=str_replace(' ','-',$judul);
    $isiberita=$this->input->post('isiberita');


    //Form Validasi jika kosong
    $this->form_validation->set_rules('judul', 'Judul', 'required');
    $this->form_validation->set_rules('isiberita', 'Isi Berita', 'required');
    if($this->form_validation->run()!=false)
    {
      $data=array(
        'judul'=>$judul,
        'isi'=>$isiberita,
        'slug'=>$slug
      );
      $this->m_berita->tambahberita($data);
      redirect(base_url());

    }
    else {
      $data['title']='Tambah Berita';
      $this->load->view('header',$data);
      $this->load->view('tambahberita');
      $this->load->view('footer');
    }
  }
  public function hapusberita($slug)
  {
    $where = array('slug' => $slug);
		$this->m_berita->hapusberita($where);
    redirect(base_url());
  }
  public function editberita($slug)
  {
    $where = array('slug' => $slug);
    $data['berita'] = $this->m_berita->tampilkansingle($where);
    $data['title']='Edit '.str_replace('-',' ',$slug);
    $this->load->view('header',$data);
    $this->load->view('editberita',$data);
    $this->load->view('footer',$data);
  }
  public function aksieditberita($slug)
  {
    //Tangkap data dari forom
    $where = array('slug' => $slug);
    $judul = $this->input->post('judul');
    $slug=str_replace(' ','-',$judul);
    $isiberita=$this->input->post('isiberita');


    //Form Validasi jika kosong
    $this->form_validation->set_rules('judul', 'Judul', 'required');
    $this->form_validation->set_rules('isiberita', 'Isi Berita', 'required');
    if($this->form_validation->run()!=false)
    {
      $data=array(
        'judul'=>$judul,
        'isi'=>$isiberita,
        'slug'=>$slug
      );
      $this->m_berita->updateberita($where,$data);
      redirect(base_url());

    }
    else {
      $data['title']='Tambah Berita';
      $this->load->view('header',$data);
      $this->load->view('tambahberita');
      $this->load->view('footer');
    }
  }
}

3. View
Tambahkan kode berikut pada file v_berita.php di folder application/views :

<a href="<?php echo base_url('berita/editberita/').$isiberita['slug'] ?>">Edit</a>

Full kode dari file v_berita.php sesudah ditambahkan kode di atas adalah sebagai berikut :


    <?php foreach ($berita as $isiberita):?>


<div class="each_article">

<h3><a href="<?php echo base_url('berita/singleberita/').$isiberita['slug'] ?>"><?php echo $isiberita['judul']; ?></a></h3>



<?php echo $isiberita['isi']; ?>
    <a href="<?php echo base_url('berita/hapusberita/').$isiberita['slug'] ?>">Hapus</a>
    <a href="<?php echo base_url('berita/editberita/').$isiberita['slug'] ?>">Edit</a>
    

</div>

  <?php endforeach; ?>

Download Source Code

Untuk full code dari DML berita di atas bisa di download di link berikut :
DML DOWNLOAD

Leave a Reply