Hitz

oop.php

Feb 14th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. class Library{
  3. public function __construct(){
  4. $this->db = new PDO('mysql:host=localhost;dbname=koperasi','root','');
  5. }
  6. public function loginuser($username, $password) {
  7. $result = $this->db->prepare("SELECT * FROM user WHERE username='$username' AND password= '$password'");
  8. $result->bindParam(1, $username);
  9. $result->bindParam(2, $password);
  10. $result->execute();
  11. $rows = $result->fetch();
  12. return $rows;
  13. }
  14. public function loginanggota($id_anggota, $nama) {
  15. $result = $this->db->prepare("SELECT * FROM anggota WHERE nama='$nama' AND id_anggota= '$id_anggota'");
  16. $result->bindParam(1, $username);
  17. $result->bindParam(2, $password);
  18. $result->execute();
  19. $rows = $result->fetch();
  20. return $rows;
  21. }
  22. ?>
Add Comment
Please, Sign In to add comment