Advertisement
Guest User

Models Pages.php

a guest
Aug 1st, 2013
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. <?php
  2. /*
  3.  *  Nama files Models : Pages.php
  4.  *  Url : /app/Models/Pages.php
  5.  *  
  6.  */
  7.  
  8. namespace Models;
  9. use Resources;
  10.  
  11. class Pages {
  12.    
  13.     private $table='pages';
  14.    
  15.     public function __construct(){        
  16.         $this->db = new Resources\Database;
  17.     }
  18.    
  19.     //***fungsi untuk mengambil semua baris pada tabel pages;
  20.    
  21.     public function GetPages(){      
  22.         Return $this->db->results("SELECT * FROM ".$this->table." ORDER BY id ASC");          
  23.     }
  24.    
  25.     //***fungsi untuk mengambil satu baris berdasarkan kode yg di minta
  26.        
  27.     public function GetPagesbyKode($kode){      
  28.         $result = $this->db->row("SELECT * FROM ".$this->table." WHERE kode='".$kode."' ");      
  29.         Return $result;
  30.     }
  31.    
  32.    
  33.     //***fungsi untuk mengambil satu baris berdasarkan id yg di minta
  34.    
  35.     public function GetPagesbyId($id){        
  36.         Return $this->db->row("SELECT * FROM ".$this->table." WHERE id='".$id."'");
  37.     }
  38.            
  39.     //***fungsi mengupdate data setelah di edit
  40.     //***$avalue=array();
  41.    
  42.     public function update($avalue, $awhere) {
  43.         $this->db->update($this->table, $avalue, $awhere);                
  44.     }  
  45.    
  46.     //***fungsi menyisipkan data baru ke database
  47.     //***$avalue=array();    
  48.     public function insert($avalue) {
  49.         $this->db->insert($this->table, $avalue);                
  50.     }    
  51.    
  52.     //***fungsi menghapus data dari database
  53.     //***$avalue=array();    
  54.     public function delete($awhere) {
  55.         $this->db->delete($this->table, $awhere);                
  56.     }  
  57.  
  58.          
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement