pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Harry Waddell <waddell@caravan.com>
To: zdu@cs.nmsu.edu
Cc: pgsql-php@postgresql.org
Subject: Re: transactions?
Date: Thu, 5 Sep 2002 00:43:04 -0700
Message-ID: <20020905004304.4da1c968.waddell@caravan.com> (raw)
In-Reply-To: <3D7703A1.867530FD@postgresql.org>
References: <3D76EE13.9A1B6676@cs.nmsu.edu>
	<3D7703A1.867530FD@postgresql.org>


> 
> 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




view thread (3+ messages)

Message-ID: <20020905004304.4da1c968.waddell@caravan.com>
Permalink:  ../20020905004304.4da1c968.waddell@caravan.com/
Also on:    postgresql.org/message-id/20020905004304.4da1c968.waddell@caravan.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: waddell@caravan.com, zdu@cs.nmsu.edu
  Subject: Re: transactions?
  In-Reply-To: <20020905004304.4da1c968.waddell@caravan.com>
  References: <3D76EE13.9A1B6676@cs.nmsu.edu> <3D7703A1.867530FD@postgresql.org> <20020905004304.4da1c968.waddell@caravan.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox