PG_NUM_ROWS(3) PG_NUM_ROWS(3)
pg_num_rows - Returns the number of rows in a result
SYNOPSIS
int pg_num_rows (resource $result)
DESCRIPTION
pg_num_rows(3) will return the number of rows in a PostgreSQL result resource.
Note
This function used to be called pg_numrows(3).
PARAMETERS
o $result
- PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
RETURN VALUES
The number of rows in the result. On error, -1 is returned.
EXAMPLES
Example #1
pg_num_rows(3) example
<?php
$result = pg_query($conn, "SELECT 1");
$rows = pg_num_rows($result);
echo $rows . " row(s) returned.
";
?>
The above example will output:
1 row(s) returned.
SEE ALSO
pg_num_fields(3), pg_affected_rows(3).
PHP Documentation Group PG_NUM_ROWS(3)