This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/app/model/Teamtable.php

42 lines
1.0 KiB
PHP
Raw Normal View History

2022-02-07 10:09:16 +00:00
<?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);
}
2022-02-09 15:59:20 +00:00
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);
}
2022-02-14 01:52:59 +00:00
public function updateTeamByID(int $id, array $params): void
2022-02-09 15:59:20 +00:00
{
2022-02-14 01:52:59 +00:00
// todo ...
2022-02-09 15:59:20 +00:00
$sth = $this->dbh->prepare('UPDATE lagtabell SET WHERE LagID = ?');
$sth->execute([$params]);
}
public function addTeam(int $id, array $params): void
{
// todo ...
}
2022-02-07 10:09:16 +00:00
}