Advertisement
hutajulu

m_anggota

Sep 9th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. class Data_anggota {
  3.  
  4.     private $mysqli;
  5.  
  6.     function __construct($conn)
  7.     {
  8.         $this->mysqli = $conn;
  9.     }
  10.  
  11.     public function tampil($id = null)
  12.     {
  13.         $db = $this->mysqli->conn;
  14.         $sql = "SELECT * FROM tb_anggota";
  15.         if ($id != null) {
  16.             $sql .= " WHERE nomor_induk = $id";
  17.         }
  18.         $query = $db->query($sql) or die ($db->error);
  19.         return $query;
  20.     }
  21.  
  22.     public function tambah($noinduk,$nama,$jk,$kelas,$jurusan,$tmplahir,$almt,$gbr)
  23.     {
  24.         $db = $this->mysqli->conn;
  25.         $db->query("INSERT INTO tb_anggota  VALUES ('$noinduk', '$nama', '$jk', '$kelas','$jurusan', '$tmplahir', '$almt', '$gbr')") or die ($db->error);
  26.     }
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement