There is a function that returns an associative array:
public function getSports(): array { $sql = 'SELECT id, name FROM Sport'; $stmt = $this->connection->prepare($sql); $stmt->execute(); return $stmt->fetchAll(); } But besides the id and name fields, there come another 0 and 1 . How to leave only id and name ?
Ps documentation read, like in fetchAll() it is necessary to transfer constants, but did not find what.
PDO::FETCH_ASSOC- Edward