-
Notifications
You must be signed in to change notification settings - Fork 0
/
dac.php
executable file
·45 lines (28 loc) · 919 Bytes
/
dac.php
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
class ConfigDao {
public function get($dbid) {
try {
// Connection
$dao = new Dao();
$db = $dao->getDb($dbid);
$conn = new mysqli($db['servername'], $db['username'], $db['password'], $db['dbname']);
if ($conn->connect_error) throw new exception();
mysqli_set_charset($conn,'utf8');
// Query
$sql = "SELECT * FROM config";
$result = $conn->query($sql);
// Get
$row = $result->fetch_assoc();
$data = array();
foreach ($row as $key => $value) {
$data[$key] = $value;
}
return $data;
} catch (Exception $e) {
throw new Exception($e->getMessage());
} finally {
$conn->close();
}
}
}
?>