Advertisement
Guest User

MysqlBase.class.php

a guest
Sep 7th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2. require 'Database.interface.php';
  3. class MysqlBase implements Database {
  4. private $host, $user, $pass, $db, $base;
  5.  
  6. public function __construtct($host, $user, $pass, $db) {
  7. $this->host = $host;
  8. $this->user = $user;
  9. $this->pass = $pass;
  10. $this->db = $db;
  11. }
  12. public function open() {
  13. $dsn = sprintf('mysql:host=%s;dbname=%s', $this->host, $this->db);
  14. $base = new PDO($dsn, $this->user, $this->pass);
  15.  
  16. }
  17. public function close() {
  18. $this->base = null;
  19.  
  20. }
  21. public function execute($strSQL) {
  22. $stmt = $this->base->prepare($strSQL);
  23. $stmt->execute();
  24. return $stmt;
  25.  
  26. }
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement