PHP Function pg_Last_Error
Article Summary
php function pg_last_error provides a way to get the last error message for a given connection. This is very useful if you want to track errors in a script and fix them. The pg_last_error function also comes in handy when you need to send the same query to multiple servers.
The pg_last_error function is used to display the latest error message for a given PostgreSQL database connection. This function is similar to pg_result_error_field but it allows you to get more detail from an error report.
Use pg_last_error instead of pg_result_error_field for better error handling. It is recommended to use the newer pg_send_query_params function to avoid problems with undefined variables and other issues.
pg_send_query_params() -- Sends a parameterized query asynchronously to the database. This is like pg_query but it can send multiple queries at once and return the results one by one. Unlike pg_query, it does not block the script execution while queries are executing and can be cancelled with pg_cancel_query(). Data inside the query must be properly escaped. This function works only with a PostgreSQL server that supports 7.4 or higher and will not work on pre-7.4 connections.
pg_set_error_verbosity() -- Sets the verbosity of error messages that are returned by pg_last_error and pg_result_error_field. This function used to be called pg_error_message().