fix team deletion issue on match listing

This commit is contained in:
sehnryr
2022-10-16 19:44:02 +02:00
committed by Youn Mélois
parent 472981fd9a
commit 46cc4a0658

View File

@@ -406,6 +406,22 @@ class Database
}
}
/**
* Delete a team
*/
public function deleteTeam(int $id): bool {
$success = true;
$request = 'DELETE from teams where id = :id';
$statement = $this->PDO->prepare($request);
$statement->bindParam(':id', $id);
$success = $statement->execute() && $success;
return $success;
}
/**
* Gets all teams in the db
*
@@ -423,7 +439,10 @@ class Database
/**
* Gets the team name according to the id
*/
public function getTeamName(int $id): ?string {
public function getTeamName(?int $id): ?string {
if ($id == null) {
return null;
}
$request = 'SELECT name from teams where id = :id';
$statement = $this->PDO->prepare($request);