Re: Error code
Gustavo Amarilla Santacruz <[email protected]> Tue, 22 Sep 2009 09:17:21 -0400
| Newsgroups | gmane.comp.db.postgresql.php |
|---|---|
| Message-ID | <[email protected]> |
Thank you, Chris. Now, I need to do this in PHP: -------------------- CODE --------------------------------------------------------------- $errorCode = pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ; if( $errorCode == UNIQUE_VIOLATION ) echo( "message 1" ); else if( $errorCode == DATETIME_FIELD_OVERFLOW ) echo( "message 2" ); -------------------- CODE --------------------------------------------------------------- How I can do it?; how I can compare $errorCode with a Postgres error name ( as in http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html ). Thank you, again. On Mon, Sep 21, 2009 at 9:00 PM, Chris <[email protected]> wrote: > Gustavo Amarilla Santacruz wrote: > >> Hello all. >> >> How I can get the postgres error code from PHP?. I can get the error text, >> but I need error code to verbose ( and country dependient) messages. >> > > http://www.php.net/manual/en/function.pg-result-error-field.php > > seems to be the best fit. > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > > -- Gustavo Amarilla