public static function Init() { $host = conf::getHostname(); $dbname = conf::getDataBase(); $login = conf::getLogin(); $pass = conf::getPassword(); try { self::$pdo = new PDO("mysql:host={$host};dbname={$dbname}", $login, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); } catch (PDOException $e) { echo $e->getMessage(); // affiche un message d'erreur die; } }
public static function Init() { $host = conf::getHostname(); $dbname = conf::getDataBase(); $login = conf::getLogin(); $pass = conf::getPassword(); try { self::$pdo = new PDO("mysql:host={$host};dbname={$dbname}", $login, $pass); } catch (PDOException $e) { echo $e->getMessage(); // affiche un message d'erreur die; } }