c1
This commit is contained in:
28
www/first.loc/api/Class/DatabaseMS.php
Normal file
28
www/first.loc/api/Class/DatabaseMS.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user