oyazhuryachna

model_penerbit

Dec 23rd, 2016
6,478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.30 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class M_penerbit extends CI_Model {
  5.  
  6.  
  7.     public function tampil(){
  8.         // menjalankan stored procedure tampil_penerbit()
  9.         $sql_query=$this->db->query("call tampil_penerbit()");                     
  10.         mysqli_next_result( $this->db->conn_id);
  11.             if($sql_query->num_rows()>0){
  12.                 return $sql_query->result_array();
  13.             }
  14.     }
  15.        
  16.     public function detail($kode_penerbit_nya){
  17.         // menjalankan stored procedure detail_penerbit()
  18.         $sql_query=$this->db->query("call detail_penerbit('".$kode_penerbit_nya."')");                     
  19.         mysqli_next_result( $this->db->conn_id);
  20.             if($sql_query->num_rows()==1){
  21.                 return $sql_query->row_array();
  22.             }
  23.     }
  24.    
  25.     public function hapus($kode_penerbit_nya){
  26.         $sql_query=$this->db->query("call hapus_penerbit('".$kode_penerbit_nya."')");                  
  27.     }
  28.  
  29.     public function simpan($kode,$nama,$kota,$email,$web,$telp){
  30.         $sql_query=$this->db->query("call tambah_penerbit('".$kode."','".$nama."','".$kota."','".$email."','".$web."','".$telp."')");                  
  31.     }
  32.  
  33.     public function ubah($kode,$nama,$kota,$email,$web,$telp){
  34.         $sql_query=$this->db->query("call ubah_penerbit('".$kode."','".$nama."','".$kota."','".$email."','".$web."','".$telp."')");                    
  35.     }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment