diff --git a/resources/database.php b/resources/database.php index ebad25b..ae12be6 100644 --- a/resources/database.php +++ b/resources/database.php @@ -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);