-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnexionBD.php
28 lines (26 loc) · 986 Bytes
/
ConnexionBD.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
<?php
class ConnexionBD
{
private static $_dbname = "sql4433253";
private static $_user = "sql4433253";
private static $_pwd = "ctn5MRnZRK";
private static $_host = "sql4.freesqldatabase.com";
private static $_bdd = null;
// to connect to database with phpmyadmin client check this link https://www.phpmyadmin.co/ and log in with credentials above.
//You can register or use our default user to log in with: email: admin@admin.com ; password: admin
private function __construct()
{
try {
self::$_bdd = new PDO("mysql:host=" . self::$_host . ";dbname=" . self::$_dbname . ";charset=utf8", self::$_user, self::$_pwd, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'));
} catch (PDOException $e) {
die('Erreur : ' . $e->getMessage());
}
}
public static function getInstance()
{
if (!self::$_bdd) {
new ConnexionBD();
}
return (self::$_bdd);
}
}