I have view similar to this one
CREATE OR REPLACE VIEW regexp_test AS (
SELECT regexp_matches(decode(\'NTB4\', \'base64\')::text, \'(\\d+)x\')
)
<
pg_query returns a result resource.
$result = pg_query('SELECT * FROM regexp_test');
while ($row = pg_fetch_row($result)) {
echo "$row";
}
pg_query returns false on error
If an error occurs, and FALSE is returned, details of the error can be retrieved using the pg_last_error() function if the connection is valid.