Witam,
dlaczego nie działają transakcje tzn. w tym skrypcie mimo iż zostało źle napisane drugie zapytanie to i tak pierwsze zostanie wykonane prawidłowo i dodane do bazy

  1. <?php
  2.  
  3.  
  4. $this->blad = true;
  5. $datadodania = time();
  6.  
  7. mysql_query( &#092;"set autocommit=0\" );
  8. mysql_query( &#092;"BEGIN\" );
  9. mysql_select_db( $this->baza );
  10.  
  11. $usluga_insert = &#092;"
  12.  insert into usluga ( usluga )
  13.  values ( &#092;"\".addslashes(strip_tags($this->usluga[usluga])).\"\" )  
  14.  &#092;";
  15.  
  16.  mysql_query( $usluga_insert );  
  17.  
  18.  if( mysql_errno() )
  19. $this->blad = false;
  20.  
  21.  
  22. $usluga_insert = &#092;"
  23.  insertttttt into usluga ( usluga )
  24.  values ( &#092;"\".addslashes(strip_tags($this->usluga[usluga])).\"\" )  
  25.  &#092;";
  26.  
  27.  mysql_query( $usluga_insert );  
  28.  
  29.  if( mysql_errno() )
  30. $this->blad = false;
  31.  
  32.  
  33.  if( $this->blad == true )
  34.  {
  35.  if( mysql_query( &#092;"commit\" ) )
  36.  {
  37. $this->blad = true;  
  38.  }
  39.  else
  40.  {
  41. $this->blad = false;
  42.  }
  43.  }
  44.  else
  45.  {
  46. mysql_query( &#092;"rollback\" );
  47. $this->blad = false;
  48.  }
  49.  
  50.  
  51.  
  52. ?>



co jest nie tak?

pozdrawiam