No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

pg_last_notice

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

pg_last_notice Returns the last notice message from PostgreSQL server

Description

pg_last_notice ( resource $connection [, int $option = PGSQL_NOTICE_LAST ] ) : mixed

pg_last_notice() returns the last notice message from the PostgreSQL server on the specified connection. The PostgreSQL server sends notice messages in several cases, for instance when creating a SERIAL column in a table.

With pg_last_notice(), you can avoid issuing useless queries by checking whether or not the notice is related to your transaction.

Notice message tracking can be set to optional by setting 1 for pgsql.ignore_notice in php.ini.

Notice message logging can be set to optional by setting 0 for pgsql.log_notice in php.ini. Unless pgsql.ignore_notice is set to 0, notice message cannot be logged.

PHP: pg_last_notice - Manual Home of Manuel PHP  Contents Haut

Parameters

connection

PostgreSQL database connection resource.

option

One of PGSQL_NOTICE_LAST (to return last notice), PGSQL_NOTICE_ALL (to return all notices), or PGSQL_NOTICE_CLEAR (to clear notices).

PHP: pg_last_notice - Manual Home of Manuel PHP  Contents Haut

Return Values

A string containing the last notice on the given connection with PGSQL_NOTICE_LAST, an array with PGSQL_NOTICE_ALL, a boolean with PGSQL_NOTICE_CLEAR, or FALSE on error.

PHP: pg_last_notice - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 pg_last_notice() example

<?php
  $pgsql_conn 
pg_connect("dbname=mark host=localhost");
  
  
$res pg_query("CREATE TABLE test (id SERIAL)");
  
  
$notice pg_last_notice($pgsql_conn);
  
  echo 
$notice;
?>

The above example will output:

CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column "test.id"

PHP: pg_last_notice - Manual Home of Manuel PHP  Contents Haut

Changelog

Version Description
7.1.0 The option parameter was added.

PHP: pg_last_notice - Manual Home of Manuel PHP  Contents Haut

See Also

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-pg-last-notice.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut