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(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)
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