Advertisement
hutajulu

m_jurusan

Sep 3rd, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <?php
  2. class Data_anggota_new {
  3. private $mysqli;
  4.  
  5. function __construct($conn)
  6. {
  7. $this->mysqli = $conn;
  8. }
  9.  
  10. public function tampil($id = null)
  11. {
  12. $db = $this->mysqli->conn;
  13. $sql = "SELECT * FROM tb_jurusan";
  14. if ($id != null)
  15. {
  16. $sql .= " WHERE id_jurusan = $id";
  17. }
  18. $query = $db->query($sql) or die ($db->error);
  19. return $query;
  20. }
  21.  
  22. function __destruct()
  23. {
  24. $db = $this->mysqli->conn;
  25. $db->close();
  26. }
  27. }
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement