Home > PHP > Function > PostgreSQL > pg_num_fields()

pg_num_fields()

pg_num_fields - Returns the number of fields in a result

Syntax

int pg_num_fields (resource $result)

Arguments

  • result - PostgreSQL query result resource, returned by pg_query(), pg_query_params() or pg_execute() (among others).

Description

pg_num_fields() returns the number of fields (columns) in a PostgreSQL result resource.

Version

PHP 4.2.0, 5

Return value

The number of fields (columns) in the result. On error, -1 is returned.