projet_php/models/mother_model.php

23 lines
No EOL
787 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 mysql:host=boulayoune.com;dbname=projet_folliow
"root", //Nom d'utilisateur de la base de données projet_user
"",// Mot de passe de la base de données F0lliowRules!
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC) // Mode de renvoi
);
// Pour résoudre les problèmes dencodage
$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();
}
}
}