pg_field_table is primarily useful for queries that involve joins between multiple tables, e.g:
<?php
$res = pg_query("SELECT table1.foo, table2.bar FROM table1 JOIN table2");
echo pg_field_table($res, 0); echo pg_field_table($res, 1); ?>
However, be aware of a few easy 'gotchas':
1- If your query contains static values in its select-list, pg_field_table() will yield FALSE for those fields (because it was a static value, not one fetched from a table):
<?php
$res = pg_query("SELECT 'foo', bar FROM table");
echo pg_field_table($res, 0); echo pg_field_table($res, 1); ?>
2- If you UNION two queries together from different tables, pg_field_table() will return FALSE for all fields:
<?php
$res = pg_query("(Select foo, bar from table1) UNION (Select foo, bar from table2)");
echo pg_field_table($res, 0); echo pg_field_table($res, 1); ?>