Received: from localhost (pluto.hub.org [200.46.204.4]) by postgresql.org (Postfix) with ESMTP id D2E899FB222 for ; Tue, 7 Nov 2006 00:43:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.4]) (amavisd-new, port 10024) with ESMTP id 17557-08 for ; Tue, 7 Nov 2006 00:42:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from n007.sc1.cp.net (smtpout1451.sc1.he.tucows.com [64.97.157.151]) by postgresql.org (Postfix) with ESMTP id E4D079FB223 for ; Tue, 7 Nov 2006 00:42:57 -0400 (AST) Received: from [192.168.0.12] (69.250.79.20) by n007.sc1.cp.net (7.2.069.1) (authenticated as rob@treat.com) id 454FCEF600008983; Tue, 7 Nov 2006 04:42:56 +0000 From: Robert Treat To: pgsql-php@postgresql.org Subject: Re: PostgreSQL locking from PHP scripts Date: Mon, 6 Nov 2006 23:34:59 -0500 User-Agent: KMail/1.9.1 Cc: Chris , Herbie McDuck , Alan Hodgson References: <20061026181147.50048.qmail@web51309.mail.yahoo.com> <454FD71E.6070807@faams.net> <454FE031.2080004@gmail.com> In-Reply-To: <454FE031.2080004@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200611062334.59629.xzilla@users.sourceforge.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/14 X-Sequence-Number: 3632 On Monday 06 November 2006 20:24, Chris wrote: > Herbie McDuck wrote: > > Alan Hodgson wrote: > >> On Thursday 26 October 2006 11:11, Amal burman > >> > >> wrote: > >>> postgresql database for this project. Here script one > >>> (booking.php) tries to setup a lock for update and ask > >>> user to fill-up the form. Now when the user fill-up > >>> the form and submit it for update, second script > >>> (update.php) update the database and releasing the > >>> locks. > >> > >> You can't do this kind of thing in PHP. PHP resets the database > >> connection between scripts. The script is finished as soon as the > >> page is delivered to the client. > >> > >> Also, web connections are stateless and there is no way to even know > >> what web server process or database connection you'll be getting on > >> subsequent page views. > > > > So is PHP and 'ANY' database a useless adventure when it goes to > > developing a robust business and accounting package? > > No, it applies to anything you do in a web browser. > > The HTTP protocol is "stateless" which means all resources, connections > etc are killed at the end of the script. Resources of any type are not > kept alive at the end of a script. > > It's not a php thing or , it's a HTTP > protocol thing. In theory you can use prepared transactions to get around this, but I've never seen anyone fully implement it in PHP. -- Robert Treat Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL