Corrected error that occured after splitting config into separate file.

This commit is contained in:
Jens 2021-02-05 21:46:17 +01:00
parent 86cb486637
commit 0fc03a39e0
2 changed files with 11 additions and 9 deletions

View File

@ -1,16 +1,16 @@
<?php
require_once("shoppingListConfig.php");
class DBLink
{
require_once("shoppingListConfig.php");
static $sqlLink = null;
public static function getDbLink()
{
if(DBLink::$sqlLink == null)
{
DBLink::$sqlLink = new mysqli(DBLink::$mysqlserver, DBLink::$mysqluser, DBLink::$mysqlpw, DBLink::$mysqldb, DBLink::$mysqlPort);
DBLink::$sqlLink = new mysqli(Configuration::$mysqlserver, Configuration::$mysqluser, Configuration::$mysqlpw, Configuration::$mysqldb, Configuration::$mysqlPort);
// Verbindung überprüfen
if (mysqli_connect_errno())

View File

@ -1,9 +1,11 @@
<?php
static $mysqlserver = 'mysql.mydomain'; //Host
static $mysqluser = 'shoppingList'; //User [It's recommended to not use root]
static $mysqlpw = 'somePassword'; //Password
static $mysqldb = 'shoppingList'; //Database
static $mysqlPort = 3306;
class Configuration
{
public static $mysqlserver = 'mysql.mydomain'; //Host
public static $mysqluser = 'shoppingList'; //User [It's recommended to not use root]
public static $mysqlpw = 'somePassword'; //Password
public static $mysqldb = 'shoppingList'; //Database
public static $mysqlPort = 3306;
}
?>