Example #1
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Connexion();
     }
     return self::$instance;
 }
Example #2
0
 public static function seConnecter($pilote, $host, $database, $user, $mdp)
 {
     if (!isset(self::$instance)) {
         $classe = __CLASS__;
         self::$instance = new $classe($pilote, $host, $database, $user, $mdp);
         try {
             self::$instance = new PDO($pilote . ':host=' . $host . ';dbname=' . $database, $user, $mdp);
             self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
             self::$instance->exec("SET NAMES 'UTF8'");
         } catch (Exception $e) {
             $e->getMessage();
         }
     }
     return self::$instance;
 }
Example #3
0
 public static function reset()
 {
     self::$instance = NULL;
 }