This commit is contained in:
144 changed files with 20649 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
// Используем для подключения к базе данных MySQL
class Database
{
// Учётные данные базы данных
private $host = "mysql:3306";
public $db_name = "tsd";
private $username = "tsduser";
private $password = "sdWs@a201!";
// private $username = "root";
// private $password = "secret";
public $conn;
// Получаем соединение с базой данных
public function getConnection()
{
$this->conn = null;
try {
$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;
}
}