Files
web_work/config/database.php
kirill.khorkov 8a93cf8657 Delete comment
2025-12-16 19:18:03 +03:00

32 lines
875 B
PHP

<?php
class Database {
private static $instance = null;
private $connection;
private function __construct() {
try {
$this->connection = new PDO(
"pgsql:host=185.130.224.177;port=5481;dbname=postgres",
"admin",
"38feaad2840ccfda0e71243a6faaecfd"
);
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->connection->exec("SET NAMES 'utf8'");
} catch(PDOException $e) {
die("Ошибка подключения: " . $e->getMessage());
}
}
public static function getInstance() {
if (self::$instance == null) {
self::$instance = new Database();
}
return self::$instance;
}
public function getConnection() {
return $this->connection;
}
}
?>