HomeMediacenter/php/Database.php
lukas-heiligenbrunner 5448d85c18 seperate class for dbconnection
created class for Movie reindexing
2020-04-04 12:21:30 +02:00

34 lines
725 B
PHP

<?php
class Database
{
private static $instance = null;
private $conn;
private $servername = "192.168.0.177";
private $username = "myuser";
private $password = "1qayxsw2";
private $dbname = "test";
// The db connection is established in the private constructor.
private function __construct()
{
// Create connection
$this->conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
}
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new Database();
}
return self::$instance;
}
public function getConnection()
{
return $this->conn;
}
}