Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 50A454767EF for ; Thu, 5 Sep 2002 03:47:38 -0400 (EDT) Received: from petra.caravan.com (ns.caravan.com [209.128.88.97]) by postgresql.org (Postfix) with ESMTP id 67CDB476A6F for ; Thu, 5 Sep 2002 03:46:32 -0400 (EDT) Received: from petra (localhost [127.0.0.1]) by petra.caravan.com (8.11.6+3.4W/8.11.6) with ESMTP id g857kDF26707 for ; Thu, 5 Sep 2002 00:46:13 -0700 (PDT) Date: Thu, 5 Sep 2002 00:43:04 -0700 To: zdu@cs.nmsu.edu Cc: pgsql-php@postgresql.org Subject: Re: transactions? Message-Id: <20020905004304.4da1c968.waddell@caravan.com> In-Reply-To: <3D7703A1.867530FD@postgresql.org> References: <3D76EE13.9A1B6676@cs.nmsu.edu> <3D7703A1.867530FD@postgresql.org> Organization: caravan publishing X-Mailer: Sylpheed version 0.8.2 (GTK+ 1.2.10; i386--netbsdelf) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit From: Harry Waddell X-Delivery-Agent: TMDA/0.61 Incoming: Harry Waddell X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/18 X-Sequence-Number: 1473 > > Zhidian Du wrote: > > > > I am writing a B/S program. I want to save all the users' inputs, for > > example, "insert into TABLE value (.....);" in the server side, how can > > I implement in PHP? > > > > also, how can I use transactions to rollback and commit in PHP? > > I use these functions to start, stop and abort transactions. [although most people would find it silly to wrap a single line of code with another function. I have my reasons.] Function begin_work($pg){ pg_FreeResult(pg_Exec($pg, "begin work")); return(TRUE); } Function end_work($pg){ pg_FreeResult(pg_Exec($pg, "end work")); return(TRUE); } Function abort_work($pg){ pg_FreeResult(pg_Exec($pg, "abort")); return(TRUE); } where $pg is the database handle from pg_[p]connect(). -- Harry Waddell Caravan Electronic Publishing