thx for your replies, i am trying to solve my concurrency problem with transaction, without success till now.
i began a session as suggested by ultraslacker, but without success.
ill post the relevant code pieces, maybe its more clear than what i want to do and do wrong.
- file
----------------------------------------------
<?php
session_start();
$verbindung = pg_pconnect("host=$host port=$port user=$user password=$password dbname=$dbname");
$queryString = "BEGIN WORK; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE";
$ergebnisNr = pg_exec ($verbindung, $queryString);
$queryString = "LOCK medium IN ROW EXCLUSIVE MODE";
$ergebnisNr = pg_exec ($verbindung, $queryString);
$queryString = "select * from medium where id=$medienid";
$ergebnisNr = pg_exec ($verbindung, $queryString);
?>
<html>
...
<form>
DISPLAY data selected from medium which is can be changed by a submit from the second file
</form>
...
</html>
2.file - This file gets the data of the form in the 1.file and changes it
<?php
session_start();
$verbindung = pg_Connect("host=$host port=$port user=$user password=$password dbname=$dbname");
$queryString = "update medium set typ='$medientyp', titel='$titel', author='$author', schlagworte='$schlagworte', erscheinungsjahr='$erscheinungsjahr', kommentar='$kommentar', zusammenfassung='$zusammenfassung' where id='$medienid'";
$ergebnisNr = pg_exec ($verbindung, $queryString);
$queryString = "commit work";
$ergebnisNr = pg_exec ($verbindung, $queryString);
?>
Do you know why this doesnt prevent concurrent updates?
2 User begin to read 1.file and see the same data, the first user alters the data and the data of the second user is dirty then and then the second user is able to alter the data too so the changes of the first user are lost - what i tried to prevent
Thx in advance