Re: Checking data inserted during a transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Lynna,

You won't be able to see it in PHPPgAdmin until after it's committed.

The new data is only available to the current transaction. Once that
transaction is committed it becomes 'live'.


With PHP, when a script finishes, it will commit any unfinished
transactions (as far as I know) so a single transaction across multiple
pages won't work.


If you have shell access, you can see the transaction issue this way:

fire up 2 shell logins then in window 1

psql -d db
create table a(a int);

begin;
insert into a(a) values(1);
select * from a;

jump to shell 2
psql -d db
select * from a;
(will be empty)


jump back to shell 1
commit;

jump to shell 2 again
you will see 1 row.


You could serialize up the data in sessions and then use that data
before adding it to the database.
See http://www.php.net/serialize and http://www.php.net/unserialize and
http://www.php.net/session

Hope that helps a bit :)

Chris.


-----Original Message-----
From: pgsql-php-owner@xxxxxxxxxxxxxx
[mailto:pgsql-php-owner@xxxxxxxxxxxxxx] On Behalf Of Lynna Landstreet
Sent: Thursday, May 13, 2004 8:46 AM
To: pgsql-php@xxxxxxxxxxxxxx
Subject: [PHP] Checking data inserted during a transaction


Hello all,

I'm working on an administrative interface in PHP for the art gallery
database I created last year, and running into a few issues.

Because information has to be entered into several different tables for
each exhibition, I've broken down the process of adding new exhibitions
to the databases into several pages, each of which processes the form
data sent from the previous page and then guides users through the next
step (artists featured in the exhibition, etc.).

I'm using transactions to handle this, so that at the end of the process
the user can (hopefully) review the data they've entered and either
commit or rollback the changes. But I'm having a bit of trouble figuring
out whether the data I'm trying to insert during the transaction is
actually being inserted. 


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux