Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Nama files Models : Pages.php
- * Url : /app/Models/Pages.php
- *
- */
- namespace Models;
- use Resources;
- class Pages {
- private $table='pages';
- public function __construct(){
- $this->db = new Resources\Database;
- }
- //***fungsi untuk mengambil semua baris pada tabel pages;
- public function GetPages(){
- Return $this->db->results("SELECT * FROM ".$this->table." ORDER BY id ASC");
- }
- //***fungsi untuk mengambil satu baris berdasarkan kode yg di minta
- public function GetPagesbyKode($kode){
- $result = $this->db->row("SELECT * FROM ".$this->table." WHERE kode='".$kode."' ");
- Return $result;
- }
- //***fungsi untuk mengambil satu baris berdasarkan id yg di minta
- public function GetPagesbyId($id){
- Return $this->db->row("SELECT * FROM ".$this->table." WHERE id='".$id."'");
- }
- //***fungsi mengupdate data setelah di edit
- //***$avalue=array();
- public function update($avalue, $awhere) {
- $this->db->update($this->table, $avalue, $awhere);
- }
- //***fungsi menyisipkan data baru ke database
- //***$avalue=array();
- public function insert($avalue) {
- $this->db->insert($this->table, $avalue);
- }
- //***fungsi menghapus data dari database
- //***$avalue=array();
- public function delete($awhere) {
- $this->db->delete($this->table, $awhere);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement