Re: transactions?

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



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



[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