Without consulting the user comments or the PDO constants list, users don't know that FETCH_KEY_PAIR exists to read a key-value list into an associative array. The PDOStatement::fetchAll page refers to PDOStatement::fetch for a list of FETCH-Values, but FETCH_KEY_PAIR makes sense only for fetchAll. So you should add something like this
To return a key-value query as an associative array, use PDO::FETCH_KEY_PAIR as query mode. The
query must retrieve exacty two columns for this to work.
Without consulting the user comments or the PDO constants list, users don't know that FETCH_KEY_PAIR exists to read a key-value list into an associative array. The PDOStatement::fetchAll page refers to PDOStatement::fetch for a list of FETCH-Values, but FETCH_KEY_PAIR makes sense only for fetchAll. So you should add something like this