From: | Ivan Horvath <pillesoft(at)yahoo(dot)co(dot)uk> |
---|---|
To: | trevor(at)hailix(dot)com, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Transactions in Postgres |
Date: | 2002-04-03 14:20:07 |
Message-ID: | 20020403142007.28671.qmail@web14703.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
hi
you do exactly twice the execution of the sql command
(pg_exec)
--- root <trevor(at)hailix(dot)com> wrote:
> HI,
>
> I am running Postgresql-7.2 with PHP 4.1.1 and I am
> beginning to use
> transactions inside of a php script:
>
> $Link = pg_connect("host=$Host dbname=$DBName
> user=$User") or die
> ("Couldn't connect to the database $DBName");
>
> $Query = "BEGIN WORK; INSERT into $TableName
> (firstname,lastname,emailaddress,comments,created)
> values('$Array[FirstName]',
>
'$Array[LastName]','$Array[email]','$Array[Comments]',
> 'now()');
> COMMIT;";
>
> // Test to see if the query was succeful or not
>
> pg_exec($Link, $Query) or die ("Couldn't insert
> name $firstname");
>
> if (pg_exec($Link,$Query)) {
> echo "<h1>Insert was successful</h1>";
> } else {
> echo "<H1>Insert was not successful</H1>";
>
> What I am finding is that this query will insert a
> new name twice in the
> database within milliseconds of each other. What am
> I missing in doing
> this? Any help is appreciated.
>
> Trevor
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org
> so that your
> message can get through to the mailing list cleanly
=====
Best Regards,
Ivan Horvath
Anyone who has never made a mistake has never tried anything new.
/Albert Einstein/
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Travis Hoyt | 2002-04-03 15:06:00 | now() and interval |
Previous Message | Jason Friedman | 2002-04-03 13:46:20 | Re: Date |