PHP.nl

pg_result_error

pg_result_error

Get error message associated with result

 **pg_result_error** PgSql\Result $result
returns any error message

associated with the instance. Therefore, the user has a better chance of getting the correct error message than with . pg_result_error``result``pg_last_error

The function can give much greater detail on result errors than . pg_result_error_field``pg_result_error

Because returns false if the query fails, you must use and to get the result handle. pg_query``pg_send_query``pg_get_result

result

Returns a . Returns empty string if there is no error. If there is an error associated with the parameter, returns false. string``result

Voorbeeld: 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);
?>

pg_result_error_field``pg_query``pg_send_query``pg_get_result``pg_last_error``pg_last_notice