Ejemplo n.º 1
0
 public static function getDbConnection()
 {
     if (!isset(Util::$dbConnection)) {
         global $dbHost, $dbUser, $dbPassword, $dbDatabase;
         Util::verifyDbConfiguration();
         $dbOptions = array();
         $dbOptions[PDO::MYSQL_ATTR_FOUND_ROWS] = true;
         Util::$dbConnection = new PDO("mysql:host=" . $dbHost . ";dbname=" . $dbDatabase, $dbUser, $dbPassword, $dbOptions);
         Util::$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     return Util::$dbConnection;
 }