16 lines
411 B
PHP
16 lines
411 B
PHP
|
<?php
|
||
|
CONST DB_HOST = "127.0.0.1";
|
||
|
const DB_DATABASE = "TP2";
|
||
|
const DB_USER = "root";
|
||
|
const DB_PASSWORD = "root";
|
||
|
|
||
|
function getPDO() {
|
||
|
try {
|
||
|
$bdd = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_DATABASE . ";charset = utf8", DB_USER, DB_PASSWORD);
|
||
|
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||
|
return $bdd;
|
||
|
} catch (Exception $e) {
|
||
|
return $e;
|
||
|
}
|
||
|
}
|