aktuelle.kurse/m133/4_Modulinhalte_und_Uebungen/D_Architektur/Lösung/merlo/database/Connection.php
Harald G. Mueller a63a769c98 muh
2022-02-23 22:44:33 +01:00

29 lines
643 B
PHP

<?php
class Connection
{
private $id = 'root';
private $pw = '';
private $host = 'localhost';
private $database = 'test';
private $table = 'artikel1';
private $link;
public function getConnection(): \mysqli
{
$this->link = mysqli_connect($this->host, $this->id, $this->pw) or die ('cannot connect');
mysqli_select_db($this->link, $this->database) or die ('cannot select DB');
return $this->link;
}
public function closeConnection(): bool
{
return mysqli_close($this->link);
}
public function getTable(): string
{
return $this->table;
}
}