PHP.nl

pg_set_error_context_visibility

pg_set_error_context_visibility

Determines the visibility of the context's error messages returned by pg_last_error and pg_result_error

int **pg_set_error_context_visibility** PgSql\Connection $connection int $visibility

Determines the visibility of the context's error messages returned by and pg_last_error``pg_result_error

connection``visibility The required visibility: ,

   or .
  `PGSQL_SHOW_CONTEXT_NEVER``PGSQL_SHOW_CONTEXT_ERRORS``PGSQL_SHOW_CONTEXT_ALWAYS`

The previous visibility level: ,

or . PGSQL_SHOW_CONTEXT_NEVER``PGSQL_SHOW_CONTEXT_ERRORS``PGSQL_SHOW_CONTEXT_ALWAYS

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;");
  }

  pg_set_error_context_visibility($dbconn, PGSQL_SHOW_CONTEXT_ALWAYS);
  $res1 = pg_get_result($dbconn);
  echo pg_result_error($res1);
?>

pg_last_error``pg_result_error