Пример #1
0
 public static function getConnection()
 {
     if (dbconnection::$dbconnection === NULL) {
         // database access credentials stored in variables
         $host = "localhost";
         $database = "n00143888playground";
         //            $username = "******";
         //            $password = "******";
         $username = "******";
         $password = "";
         $dsn = "mysql:host=" . $host . ";dbname=" . $database;
         dbconnection::$dbconnection = new PDO($dsn, $username, $password);
         if (!dbconnection::$dbconnection) {
             die("Database connection failed");
         }
     }
     return dbconnection::$dbconnection;
 }