Guest User

Untitled

a guest
Feb 3rd, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2. class DB
  3. {
  4. public $host = 'localhost';
  5. public $username = 'aaron_aaron';
  6. public $pass = 'd6G4X5S54';
  7. public $dbname = 'aaron_aaron';
  8.  
  9. public function __construct()
  10. {
  11. try {
  12. $this->db = new PDO("mysql:host=$this->host;dbname=$this->dbname",$this->username,$this->pass);
  13. }
  14. catch (PDOException $e){
  15. echo $e->getMessage();
  16. }
  17. }
  18.  
  19. public function members($members)
  20. {
  21. try
  22. {
  23. $stmt = $this->db->prepare("SELECT displayname FROM members");
  24. $stmt->execute();
  25. $userRow = $stmt->fetch(PDO::FETCH_ASSOC);
  26. }
  27. catch (PDOException $e){
  28. echo $e->getMessage();
  29. }
  30. }
  31. }
  32.  
  33. $conn = new DB();
  34.  
  35. ?>
Add Comment
Please, Sign In to add comment