(PHP 4 >= 4.2.0, PHP 5)
pg_fetch_result — Returns values from a result resource
pg_fetch_result() returns the value of a particular row and field (column) in a PostgreSQL result resource.
This function used to be called pg_result().
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, next row is fetched.
Boolean is returned as "t" or "f". All other types, including arrays are returned as strings formatted in the same default PostgreSQL manner that you would see in the psql program. Database NULL values are returned as
FALSE is returned if
row exceeds the number of rows in the set, or on any other error.
Example #1 pg_fetch_result() example
$db = pg_connect("dbname=users user=me") || die();
$res = pg_query($db, "SELECT 1 UNION ALL SELECT 2");
$val = pg_fetch_result($res, 1, 0);
echo "First field in the second row is: ", $val, "\n";
The above example will output:
First field in the second row is: 2