Files
ppeasy7_4/public/ddown/dropdown.php
T
2026-09-10 10:28:24 +02:00

33 lines
730 B
PHP

<?php
require_once __DIR__ . '/../../vendor/autoload.php';
if (!isset($_ENV['DB_HOST'])) {
Dotenv\Dotenv::createImmutable(__DIR__ . '/../../')->safeLoad();
}
Class Dropdown
{
private $host;
private $username;
private $password;
private $dbname;
private $connection;
//establish connection
public function __construct()
{
$this->host = $_ENV['DB_HOST'] ?? 'localhost';
$this->username = $_ENV['DB_USERNAME'] ?? '';
$this->password = $_ENV['DB_PASSWORD'] ?? '';
$this->dbname = $_ENV['DB_DATABASE'] ?? '';
try
{
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
}
catch (Exception $e)
{
echo "Connection error " . $e->getMessage();
}
}