Ejemplo n.º 1
0
 /**
  * Singleton instance
  *
  * @return Object
  */
 public static function getInstance($dbHost, $dbUser, $dbPasswd, $dbName, $dbCharset)
 {
     if (self::$_instance === null) {
         self::$_instance = new self($dbHost, $dbUser, $dbPasswd, $dbName, $dbCharset);
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 /**
  * Get single instance of class
  * 
  * @return MyPDO
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         $dbConfig = (require_once __DIR__ . '/../dbconfig.php');
         self::$_instance = new MyPDO($dbConfig);
         if (is_null(self::$_instance)) {
             self::$_instance = new MyPDO($dbConfig);
         } else {
             self::$_instance->exec("set names utf8");
         }
     }
     return self::$_instance;
 }