Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- Class Model_alumni extends CI_Model{
- function __construct()
- {
- parent::__construct();
- }
- public function tampil(){
- return $this->db->get('alumni')->result();
- }
- public function insert($data){
- $this->db->insert('alumni',$data);
- }
- public function update($data,$where){
- $this->db->update('alumni',$data,$where);
- }
- public function get_by_id($id){
- return $this->db->get_where('alumni',array('id'=>$id))->row();
- }
- public function getAllUser(){
- return $this->db->get('alumni')->result_array();
- }
- public function hapusData($id){
- $_id = $this->db->get_where('alumni',['id' => $id])->row();
- $query=$this->db->delete('alumni',['id'=>$id]);
- if($query){
- unlink("./upload/ijazah/".$_id->foto1);
- unlink("./upload/ijazah/".$_id->foto2);
- }
- }
- function simpan($data = array())
- {
- $jumlah = count($data);
- if ($jumlah > 0)
- {
- $this->db->insert_batch('alumni', $data);
- }
- }
- function getAll()
- {
- $this->db->from('alumni'); //nama tabel harap disesuaikan dengan nama tabel milik sobat
- return $this->db->get();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement