pg_transaction_status() returns the current in-transaction status
of the server.
The status can be PGSQL_TRANSACTION_IDLE (currently idle),
PGSQL_TRANSACTION_ACTIVE (a command is in progress),
PGSQL_TRANSACTION_INTRANS (idle, in a valid transaction block),
or PGSQL_TRANSACTION_INERROR (idle, in a failed transaction block).
PGSQL_TRANSACTION_UNKNOWN is reported if the connection is bad.
PGSQL_TRANSACTION_ACTIVE is reported only when a query
has been sent to the server and not yet completed.
Caution
pg_transaction_status() will give incorrect results when using
a PostgreSQL 7.3 server that has the parameter autocommit
set to off. The server-side autocommit feature has been
deprecated and does not exist in later server versions.
Examples
Example 1. pg_transaction_status() example
<?php $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); $stat = pg_transaction_status($dbconn); if ($stat === PGSQL_TRANSACTION_UNKNOWN) { echo 'Connection is bad'; } else if ($stat === PGSQL_TRANSACTION_IDLE) { echo 'Connection is currently idle'; } else { echo 'Connection is in a transaction state'; } ?>
Php pg transaction Function syntax tag
pg transaction php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php pg transaction syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.