-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb1.php
47 lines (24 loc) · 751 Bytes
/
db1.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
46
47
<?php
Class Database {
private $server = "mysql:host=localhost;dbname=UAS";
private $user = "root";
private $pass = "";
private $options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,);
protected $con;
public function connect()
{
try
{
$this->con = new PDO($this->server, $this->user,$this->pass,$this->options);
return $this->con;
}
catch (PDOException $e)
{
echo "There is some problem in connection: " . $e->getMessage();
}
}
public function closeConnection() {
$this->con = null;
}
}
?>