The php Function pg_Fetch_Object()
The php function pg_fetch_object() returns the current row of a result set as an object. It is similar to pg_fetch_array() but has several important differences, particularly in how numeric values are referenced. The pg_fetch_object() function returns an associative array, rather than an integer index starting at 0. The pg_fetch_array() functions are faster than pg_fetch_object() but the difference is not significant.
pg_fetch_object() can be used in conjunction with pg_insert() or pg_delete() to construct WHERE clauses. For example, an associative array of column names and values is ANDed together to form a table-name part of the WHERE clause for the DELETE command.
To use pg_fetch_object(), you need a database handle and a query string. You can get these by calling pg_query(), pg_query_params(), or pg_exec(). pg_query() returns a result set handle if successful; it returns FALSE if there are errors or nothing is returned.
You can also get some metadata about a result set by calling pg_num_rows() or pg_num_fields(). However, pg_field_name() does not return details about user-defined types or domains, and pg_field_num() doesn't report column number indices, which are useful for referenced columns in SELECT statements.
In the example above, you use pg_fetch_object() to return an associative array of column values, which you then use in your HTML table with