getting transactions to work

Поиск
Список
Период
Сортировка
От reiner peterke
Тема getting transactions to work
Дата
Msg-id 27ABA345-E238-11D8-8EE0-000A95984CA6@drizzle.com
обсуждение исходный текст
Ответы Re: [0.2] getting transactions to work  (Rod K <rod@23net.net>)
Список pgsql-php
there seems to be very little info around on actually using
transactions with postgres.  i've tried to create a page that will take
input from a form and insert it into my database.  it works if i just
do it without transactions but when i try to use with the begin and
commit sections of code, it doesn't update the data base.  i'm guessing
it is doing a rollback when my page loads itself again.  can anyone
help me out here ?

thanks

r

code below

<html>
<head>
<submitle>those eyes</submitle>
</head>
<body>
   <?
   $conn = pg_connect("dbname=entish user=postgres");
     if(!$conn)
     {
       print "not for the chocolate";
       exit;
     }
   if ($_POST[submit])  {

     $begin = pg_query("begin");
     $isql = "insert into diety(diety,culture,gender)
               values
('$_POST[diety]','$_POST[culture]','$_POST[gender]')";
     printf("-- %s --\n",$isql);
     $results = pg_query($isql);
     ?>
     <form method="post" action="<? echo $PHP_SELF?>">
       <input type="Submit" name="action" value="commit">
       <input type="Submit" name="action" value="rollback">
     </form>
     <?
   }
   else if(!$_POST[action]) {
   ?>
     <form method="post" action="<? echo $PHP_SELF?>">
       Diety:<input type="text" name="diety"><br>
       Culture:<input type="text" name="culture"><br>
       Gender:<input type="text" name="gender"><br>
       <input type="Submit" name="submit" value="enter">
     </form>
     <?
   }
   else {
     if($_POST[action] == 'commit') {
       echo "let me see";
       $act = pg_query("commit");
     }
     else {
       $act = pg_query("rollback");
       }
   }  //end if $_POST[submit]
?>
</body>
</html>



В списке pgsql-php по дате отправления:

Предыдущее
От: Daniel Struck
Дата:
Сообщение: Re: [ADMIN] Secure DB Systems - How to
Следующее
От: Rod K
Дата:
Сообщение: Re: [0.2] getting transactions to work