PG_RESULT_ERROR(3) PG_RESULT_ERROR(3)
pg_result_error - Get error message associated with result
SYNOPSIS
string pg_result_error (resource $result)
DESCRIPTION
pg_result_error(3) returns any error message associated with the $result resource. Therefore, the user has a better chance of getting the
correct error message than with pg_last_error(3).
The function pg_result_error_field(3) can give much greater detail on result errors than pg_result_error(3).
Because pg_query(3) returns FALSE if the query fails, you must use pg_send_query(3) and pg_get_result(3) to get the result handle.
PARAMETERS
o $result
- PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
RETURN VALUES
Returns a string. Returns empty string if there is no error. If there is an error associated with the $result parameter, returns FALSE.
EXAMPLES
Example #1
pg_result_error(3) example
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from doesnotexist;");
}
$res1 = pg_get_result($dbconn);
echo pg_result_error($res1);
?>
SEE ALSO
pg_result_error_field(3), pg_query(3), pg_send_query(3), pg_get_result(3), pg_last_error(3), pg_last_notice(3).
PHP Documentation Group PG_RESULT_ERROR(3)