pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedtransactions?
3+ messages / 3 participants
[nested] [flat]
* transactions?
@ 2002-09-05 05:39 Zhidian Du <zdu@cs.nmsu.edu>
2002-09-05 07:11 ` Re: transactions? Justin Clift <justin@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Zhidian Du @ 2002-09-05 05:39 UTC (permalink / raw)
To: pgsql-php
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?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: transactions?
2002-09-05 05:39 transactions? Zhidian Du <zdu@cs.nmsu.edu>
@ 2002-09-05 07:11 ` Justin Clift <justin@postgresql.org>
2002-09-05 07:43 ` Re: transactions? Harry Waddell <waddell@caravan.com>
0 siblings, 1 reply; 3+ messages in thread
From: Justin Clift @ 2002-09-05 07:11 UTC (permalink / raw)
To: Zhidian Du <zdu@cs.nmsu.edu>; +Cc: pgsql-php
Hi Zhidian,
How far have you gotten?
For example, have you used databases with PHP before? PostgreSQL has a
group of functions in PHP, and generally the first one you use is the
pg_pconnect() function, with some parameters to tell it how to connect,
where to, etc.
Then you can do stuff like execute queries against a database you've
already prepared, and so forth.
When actually inserting user data, if you need to keep it "as is" but
you'd like to be able to display it back at some point, I reckon you'll
be interested in the rawurlencode() and rawurldecode() functions.
Generally when I code stuff the very first thing that happens is that
all external input is made "safe" with rawurlencode() and that's how it
gets used internally from there on, that's how it gets stored, etc. The
only time it gets rawurldecode()'d is as part of an echo string back to
the outside world.
Does that help?
:-)
Regards and best wishes,
Justin Clift
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?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: transactions?
2002-09-05 05:39 transactions? Zhidian Du <zdu@cs.nmsu.edu>
2002-09-05 07:11 ` Re: transactions? Justin Clift <justin@postgresql.org>
@ 2002-09-05 07:43 ` Harry Waddell <waddell@caravan.com>
0 siblings, 0 replies; 3+ messages in thread
From: Harry Waddell @ 2002-09-05 07:43 UTC (permalink / raw)
To: zdu@cs.nmsu.edu; +Cc: pgsql-php
>
> 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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-09-05 07:43 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-05 05:39 transactions? Zhidian Du <zdu@cs.nmsu.edu>
2002-09-05 07:11 ` Justin Clift <justin@postgresql.org>
2002-09-05 07:43 ` Harry Waddell <waddell@caravan.com>
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