Skip to content

PDO::FETCH_KEY_PAIR is undocumented on PDO::fetchAll #1425

@Rolf-B

Description

@Rolf-B

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Extension: pdoAll PDO related doc issuesbugDocumentation contains incorrect informationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions