Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Database
- {
- private $host;
- private $dbUser;
- private $dbPassword;
- private $dbName;
- private $connect;
- public function __construct ($host, $dbUser, $dbPassword, $dbName)
- {
- $this-> host = $host;
- $this-> dbUser = $dbUser;
- $this-> dbPassword = $dbPassword;
- $this-> dbName = $dbName;
- }
- public function DBconnection()
- {
- try {
- $db = new PDO('mysql:host='.$this->host.';dbname='.$this->dbName.';charset=utf8', $this->dbUser, $this->dbPassword);
- } catch (PDOException $e) {
- print "Błąd połączenia z bazą!: " . $e->getMessage() . "<br/>";
- die();
- }
- }
- public function Close ()
- {
- $this->connect->close();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement