41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
class Teamtable
|
|
{
|
|
public PDO $dbh;
|
|
|
|
public function __construct(Database $database)
|
|
{
|
|
$this->dbh = $database->conn;
|
|
}
|
|
|
|
public function getTable(): array
|
|
{
|
|
$sth = $this->dbh->query('SELECT * FROM lagtabell');
|
|
return $sth->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function deleteTeamByID(int $LagID): void
|
|
{
|
|
$sth = $this->dbh->prepare('DELETE FROM lagtabell WHERE LagID = ?');
|
|
$sth->execute([$LagID]);
|
|
}
|
|
|
|
public function getTeamByID(int $LagID) # Mixed, array if exists, false if not
|
|
{
|
|
$sth = $this->dbh->prepare('SELECT * FROM lagtabell WHERE LagID = ?');
|
|
$sth->execute([$LagID]);
|
|
return $sth->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function updateTeam(int $id, array $params): void
|
|
{
|
|
$sth = $this->dbh->prepare('UPDATE lagtabell SET WHERE LagID = ?');
|
|
$sth->execute([$params]);
|
|
}
|
|
|
|
public function addTeam(int $id, array $params): void
|
|
{
|
|
// todo ...
|
|
}
|
|
} |