Files
tsd_test/www/first.loc/api/mysql_api/Class/DatabaseMS.php
T
admin_ps 4df494767b
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m48s
c4
2026-03-25 14:11:55 +00:00

29 lines
814 B
PHP
Executable File

<?php
// Используем для подключения к базе данных MySQL
class DatabaseMS
{
// Учётные данные базы данных
private $host = "omega-server";
public $db_name = "SKL_BLOKSQL";
private $username = "sa";
private $password = "haqdvega#";
public $conn;
// Получаем соединение с базой данных
public function getConnection()
{
$this->conn = null;
try {
$this->conn = new PDO("dblib:host=" . $this->host . ";dbname=" . $this->db_name.";charset=CP1251", $this->username, $this->password);
} catch (PDOException $exception) {
echo "Ошибка соединения с БД: " . $exception->getMessage();
}
return $this->conn;
}
}