ça commence doucement
hehehe c b1 de kodé
This commit is contained in:
parent
2255eafc08
commit
28f57e9835
8 changed files with 517 additions and 11 deletions
23
config/database.php
Normal file
23
config/database.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
class Connect {
|
||||
|
||||
protected $_db;
|
||||
|
||||
public function __construct(){
|
||||
try{
|
||||
// Connexion à la base de données
|
||||
$this->_db = new PDO(
|
||||
"mysql:host=localhost;dbname=projet_folliow", // Serveur et BDD
|
||||
"root", //Nom d'utilisateur de la base de données
|
||||
"",// Mot de passe de la base de données
|
||||
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC) // Mode de renvoi
|
||||
);
|
||||
// Pour résoudre les problèmes d’encodage
|
||||
$this->_db->exec("SET CHARACTER SET utf8");
|
||||
// Configuration des exceptions
|
||||
$this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException$e) {
|
||||
echo "Échec : " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue