Re: PostgreSQL and transactions.

From: Date: Mon, 08 Oct 2001 16:42:05 +0000
Subject: Re: PostgreSQL and transactions.
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13121@lists.php.net to get a copy of this message
Hi, Connect using 2 different userids. Bye, John Morten Bruun <morten.bruun@munkey.co.uk> wrote in message news:Pine.LNX.4.33.0110081204530.3653-100000@saturn.munkey.co.uk... > Hi there! > > I was thinking about using PostgreSQL because I need the transaction > management features, but I've come across a problem: > > $connection1 = pg_pconnect('dbname=mydb'); > $connection2 = pg_pconnect('dbname=mydb'); > > pg_exec($connection1, "begin"); > pg_Exec($connection1, "insert into mytable values ('firstvalue')"); > pg_Exec($connection2, "insert into mytable values ('secondvalue')"); > pg_Exec($connection1, "rollback"); > > This piece of code didn't do what I expected it to do. I does not insert > 'secondvalue' into the table mytable. I looked around in the manual > (http://www.php.net/manual/en/) and found out that two identical calls to > pg_connect() returns the same connection. > > Is there any way of avoiding this? And does that mean that different > request to a php page gets the same connection to the database? > > Thanks in advance! > > /Morten >

« previous php.db (#13121) next »