From: | root <trevor(at)hailix(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Transactions in Postgres |
Date: | 2002-04-03 13:14:46 |
Message-ID: | 3CAB0046.71962952@hailix.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Harald Lux | 2002-04-03 13:27:37 | Re: Formatted printing output |
Previous Message | cristi voinicaru | 2002-04-03 06:19:53 | Date |