-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdatabase.php
More file actions
31 lines (26 loc) · 796 Bytes
/
Copy pathdatabase.php
File metadata and controls
31 lines (26 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
class Database extends mysqli {
private $servername = "localhost";
private $username = "NAME";
private $password = "PASS";
private $dbname = "quotes";
private static $instance = null;
public function __construct() {
parent::__construct($this->servername, $this->username, $this->password, $this->dbname);
if ($this->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
}
public static function getInstance() {
if (self::$instance == null) {
self::$instance = new Database();
}
return self::$instance;
}
public function exec($s) {
return $this->query($s);
}
public function escape_string($s) {
return parent::real_escape_string($s);
}
}