Transactions in Postgres
От | root |
---|---|
Тема | Transactions in Postgres |
Дата | |
Msg-id | 3CAB0046.71962952@hailix.com обсуждение исходный текст |
Ответы |
Re: Transactions in Postgres
Re: Transactions in Postgres Re: Transactions in Postgres |
Список | 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
В списке pgsql-novice по дате отправления: