Add DatabaseCredentials class and implement database picker question
This commit is contained in:
@ -8,9 +8,9 @@ class MysqliConnection
|
||||
{
|
||||
private mysqli $connection;
|
||||
|
||||
public function __construct($hostname, $user, $password)
|
||||
public function __construct(DatabaseCredentials $credentials)
|
||||
{
|
||||
$this->connection = new mysqli($hostname, $user, $password);
|
||||
$this->connection = new mysqli($credentials->getHostname(), $credentials->getUser(), $credentials->getPassword());
|
||||
if ($this->connection->connect_error) {
|
||||
throw new \Exception("Connection failed: " . $this->connection->connect_error);
|
||||
}
|
||||
|
Reference in New Issue
Block a user