-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDbConnection.php
More file actions
29 lines (26 loc) · 824 Bytes
/
DbConnection.php
File metadata and controls
29 lines (26 loc) · 824 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
<?php
class DbConnection {
private $user;
private $password;
private $database;
public $certificateDao;
public $userDao;
public $updateEventDao;
public $logEventDao;
public function __construct($config) {
$this->user = $config->getUser();
$this->password = $config->getPassword();
$this->database = $config->getDatabase();
}
function openDbConnection(){
$this->link = mysqli_connect('localhost', $this->user, $this->password, $this->database) or die("Problem z polaczeniem z baza danych.");
$this->certificateDao = new CertificateDao($this->link);
$this->userDao = new UserDao($this->link);
$this->updateEventDao = new UpdateEventDao($this->link);
$this->logEventDao = new LogEventDao($this->link);
}
function closeDbConnection() {
mysqli_close($this->link);
}
}
?>