-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
39 lines (30 loc) · 905 Bytes
/
config.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
<?php
//Connection to xamp database.
//define("DB_DATA_SOURCE", "mysql:host=localhost;dbname=u1470153");
//define("DB_USERNAME", 'root');
//define("DB_PASSWORD","");
//connection to selene
define("DB_DATA_SOURCE", "mysql:host=localhost;dbname=u1470153");
define("DB_USERNAME", 'u1470153');
define("DB_PASSWORD",""); //add password
//check that we can connect to the database.
class ConnectionFactory{
private static $conn;
public static function connect()
{
if(!self::$conn)
{
try{
self::$conn = new PDO(DB_DATA_SOURCE, DB_USERNAME, DB_PASSWORD);
//echo " Database connected";
}
catch (PDOException $exception)
{
echo "Oops, you brooke it" . $exception->getMessage();
}
}
return self ::$conn;
}
}
$conn=ConnectionFactory::connect();
?>