If there is an error in one of your queries, the queries following it will not get executed, and there will *not* be an error message displayed. The only way I can think of to determine if an SQL error happened is to use pg_trace.
Example:
pg_send_query($connection,
"SELECT id FROM users;
SELECT * FROM customers;
[INVALID-SQL-STATEMENT];
SELECT name FROM countries;");
while ($result = pg_get_result($connection))
$results[] = $result;
The $results array will only have two items in it.