1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
PHP_TP2/db.php

16 lines
411 B
PHP
Raw Normal View History

2020-09-12 14:31:17 +02:00
<?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;
}
}