Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pg_last_error(3) [php man page]

PG_LAST_ERROR(3)														  PG_LAST_ERROR(3)

pg_last_error - Get the last error message string of a connection

SYNOPSIS
string pg_last_error ([resource $connection]) DESCRIPTION
pg_last_error(3) returns the last error message for a given $connection. Error messages may be overwritten by internal PostgreSQL (libpq) function calls. It may not return an appropriate error message if multi- ple errors occur inside a PostgreSQL module function. Use pg_result_error(3), pg_result_error_field(3), pg_result_status(3) and pg_connection_status(3) for better error handling. Note This function used to be called pg_errormessage(3). PARAMETERS
o $connection - PostgreSQL database connection resource. When $connection is not present, the default connection is used. The default connection is the last connection made by pg_connect(3) or pg_pconnect(3). RETURN VALUES
A string containing the last error message on the given $connection, or FALSE on error. EXAMPLES
Example #1 pg_last_error(3) example <?php $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); // Query that fails $res = pg_query($dbconn, "select * from doesnotexist"); echo pg_last_error($dbconn); ?> SEE ALSO
pg_result_error(3), pg_result_error_field(3). PHP Documentation Group PG_LAST_ERROR(3)

Check Out this Related Man Page

PG_RESULT_ERROR_FIELD(3)												  PG_RESULT_ERROR_FIELD(3)

pg_result_error_field - Returns an individual field of an error report.

SYNOPSIS
string pg_result_error_field (resource $result, int $fieldcode) DESCRIPTION
pg_result_error_field(3) returns one of the detailed error message fields associated with $result resource. It is only available against a PostgreSQL 7.4 or above server. The error field is specified by the $fieldcode. Because pg_query(3) and pg_query_params(3) return FALSE if the query fails, you must use pg_send_query(3) and pg_get_result(3) to get the result handle. If you need to get additional error information from failed pg_query(3) queries, use pg_set_error_verbosity(3) and pg_last_error(3) and then parse the result. PARAMETERS
o $result - A PostgreSQL query result resource from a previously executed statement. o $fieldcode - Possible $fieldcode values are: PGSQL_DIAG_SEVERITY, PGSQL_DIAG_SQLSTATE, PGSQL_DIAG_MESSAGE_PRIMARY, PGSQL_DIAG_MESSAGE_DETAIL, PGSQL_DIAG_MESSAGE_HINT, PGSQL_DIAG_STATEMENT_POSITION, PGSQL_DIAG_INTERNAL_POSITION (PostgreSQL 8.0+ only), PGSQL_DIAG_INTER- NAL_QUERY (PostgreSQL 8.0+ only), PGSQL_DIAG_CONTEXT, PGSQL_DIAG_SOURCE_FILE, PGSQL_DIAG_SOURCE_LINE or PGSQL_DIAG_SOURCE_FUNC- TION. RETURN VALUES
A string containing the contents of the error field, NULL if the field does not exist or FALSE on failure. EXAMPLES
Example #1 pg_result_error_field(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_field($res1, PGSQL_DIAG_SQLSTATE); ?> SEE ALSO
pg_result_error(3). PHP Documentation Group PG_RESULT_ERROR_FIELD(3)
Man Page

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Error message: What does it mean?

I get this error message in my maillog. Can someone tell me what it means? SYSERR(root): collect: I/O error on connection from mail-05.goomba.com I guess it means that the server could not connect to mail-06.goomba.com. Is my interpretation correct? Any idea why it happens? (1 Reply)
Discussion started by: mojoman
1 Replies

2. Solaris

Backup and multi Path network

Dear All I have three site in multi city and have in three site ADSL connection with Fixed IP and three Connection leased line (VHSDSL) and and the primary connection it's VHSDSL and BAckup up connection ADSL So can i use IPMP in solaris OS 10 in three Site to have this Service in three Site... (0 Replies)
Discussion started by: Hosam
0 Replies

3. UNIX for Dummies Questions & Answers

Query :: Using Netstat finding total value to a db connection

I wrote a very simple script to calculate the DB connection from an appserver and check the total netstat connection to a particular DB exceed 25 then it will send mail netstat -a 2> /dev/null | awk '/.*ESTAB/{print $5}' | cut -d. -f1 | uniq -c | awk '{if ($1 > 25)print $2," exceed ",$1;}' ... (1 Reply)
Discussion started by: senthil.ak
1 Replies

4. Linux

connection from where?

Hi All, I got this /var/log/messages and I would like to know where this came from messages:Feb 3 16:30:10 localhost PAM-Wheel: unknown user admin messages:Feb 3 16:30:12 localhost pam_tally: pam_tally: pam_get_uid; no such user admin messages:Feb 3 16:30:12 localhost PAM-Wheel: unknown... (0 Replies)
Discussion started by: itik
0 Replies

5. UNIX for Dummies Questions & Answers

winscp error: Network error connection timed out

Hi all, I am trying to winscp to RHEL5 server and i am ending up with following error. Network error:connection timed out The system is up and running but not able to winscp. Tried SFTP,SCP and FTP protocols in winscp but none worked. I can ssh into this server from another server... (3 Replies)
Discussion started by: lramsb4u
3 Replies

6. UNIX for Dummies Questions & Answers

Error Handling using ISQL for oracle connection in Perl

Hi Am making connection to oracle using ISQL as shown in the code. This code is just a minor part of a big code. I want to capture the error if the password/login is wrong or if connection is not made. I need to capture the error code also. Also, If such an error occurs, i need to exit out... (4 Replies)
Discussion started by: irudayaraj
4 Replies

7. UNIX for Dummies Questions & Answers

How to find Hung connection in UNix Systems ?

Hi Gurus , How to find Hung connection in Unix Systems I use ps -ef | grep "XXXX" it lists out some conections..How to know what is hung connection in there.. (3 Replies)
Discussion started by: Hyp_Todd
3 Replies