pg_fetch_object() returns an object with properties that correspond to the fetched row. It returns FALSE if there are no more rows or error.
pg_fetch_object() is similar to pg_fetch_array(), with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets (numbers are illegal property names).
result_type is optional parameter controls how return value is initialized. result_type is a constant and can take the following values: PGSQL_ASSOC, PGSQL_NUM, and PGSQL_BOTH. pg_fetch_array() returns associative array that has field name as key for PGSQL_ASSOC. field index as key with PGSQL_NUM and both field name/index as key with PGSQL_BOTH. Default is PGSQL_BOTH.
Notatka: result_type was added in PHP 4.0.
Speed-wise, the function is identical to pg_fetch_array(), and almost as quick as pg_fetch_row() (the difference is insignificant).
See also pg_exec(), pg_fetch_array(), pg_fetch_row() and pg_result().
Notatka: From 4.1.0, row became optional.
Poprzedni | Spis treści | Następny |
pg_fetch_array | Początek rozdziału | pg_fetch_row |