Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m48s
32 lines
1.0 KiB
PHP
Executable File
32 lines
1.0 KiB
PHP
Executable File
<?php
|
||
// Используем для подключения к базе данных MySQL
|
||
class Database
|
||
{
|
||
// Учётные данные базы данных
|
||
//private $host = "localhost:3308";
|
||
private $host = "10.10.1.246";
|
||
//public $db_name = "authentication_jwt";
|
||
private $db_name = "tsd_user";
|
||
private $username = "tsd";
|
||
//private $password = "Dfrgvm3@1";
|
||
private $password = "gcIL6UrWFtSdDTbz";
|
||
|
||
|
||
public $conn;
|
||
|
||
// Получаем соединение с базой данных
|
||
public function getConnection()
|
||
{
|
||
$this->conn = null;
|
||
|
||
try {
|
||
$this->conn = new PDO("pgsql:host=".$this->host.";port=5432;dbname=".$this->db_name, $this->username, $this->password);
|
||
//$this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name.";charset=UTF8", $this->username, $this->password);
|
||
} catch (PDOException $exception) {
|
||
echo "Ошибка соединения с БД: " . $exception->getMessage();
|
||
}
|
||
|
||
return $this->conn;
|
||
}
|
||
}
|