Branche classes
This commit is contained in:
20
donnees/Database.php
Normal file
20
donnees/Database.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class Database {
|
||||
private $ip = "localhost";
|
||||
private $user = "adminBibli";
|
||||
private $pass = "mdpBibli";
|
||||
private $database = "bdbibliotheque";
|
||||
|
||||
public function connexionDB() {
|
||||
$dsn = "mysql:host=$this->ip;dbname=$this->database;charset=utf8mb4";
|
||||
try {
|
||||
$db = new PDO($dsn, $this->user, $this->pass);
|
||||
return $db;
|
||||
} catch (PDOException $e) {
|
||||
die("Erreur de connexion : " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user