RE: [PHP-DB] Ensuring users don't overwrite each other (NOT a newbie question)

From: Date: Fri, 01 Feb 2002 15:48:45 +0000
Subject: RE: [PHP-DB] Ensuring users don't overwrite each other (NOT a newbie question)
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16406@lists.php.net to get a copy of this message
Thats the most elegant and probably easiest to implement, now I just need to figure out when to do a roll back I know the commands (COMMIT or ROLLBACK just don't know how to put it in my transaction - is it something like if(@@ERROR) ROLLBACK As I have read the manual (both MSSQL and PHP) but I am non- the wiser how to prevent an uncommited dependancy any quick example code you could provide would be really great or a T-SQL tutorial (I am familar with SQL just not the transaction bit). Thanks Ollie -----Original Message----- From: DL Neil [mailto:PHPml@DandE.HomeChoice.co.uk] Sent: 02 February 2002 15:40 To: oliver@cronky.net; hugh_bothwell@hotmail.com; Php-Db ML Subject: Re: [PHP-DB] Ensuring users don't overwrite each other (NOT a newbie question) Ollie, Probably easier to repeat the 'read' (from the first population of the user form) - and then do the comparison(s) in PHP - either way it will a SQL query that must be evaluated by PHP before the UPDATE is issued. ie put the interaction in a function and call it from the two locations in the code! That way you don't have essentially the same logic implemented in two places (fatal when you come to modify the code/db). Regards, =dn ----- Original Message ----- From: "Oliver Cronk" <ocronk@essex.ac.uk> To: <hugh_bothwell@hotmail.com>; "Php-Db ML" <php-db@lists.php.net> Sent: 01 February 2002 15:23 Subject: Re: [PHP-DB] Ensuring users don't overwrite each other (NOT a newbie question) > Yes thats an interesting idea, and this compare-and-modify-if-unchanged bit > would be implemented via SQL IF statement(s) perhaps? > > Thanks > > Ollie > > "Hugh Bothwell" <hugh_bothwell@hotmail.com> wrote in message > news:<20020201133107.1062.qmail@pb1.pair.com>... > > > > "Oliver Cronk" <ocronk@essex.ac.uk> wrote in message > > news:NGENLNMKBJNBIAFJLPBHOEMPCBAA.ocronk@essex.ac.uk... > > > Thanks for that answer, you filled in some of the blanks for the table / > > > logging solution, but I am now looking at row locking instead of a > > seperate > > > table (and then doing things similar to what you outlined). > > > > Just a thought - if you have the user form echo a copy of the original > data > > back (ie in addition to the modified data), you can compare it to the > > existing data and warn the user if the data has been changed in the > interim. > > You must make the [compare-and-modify-if-unchanged] atomic, but that's > okay, > > because it's all in the same script anyway - it becomes reasonable to do > it > > as a transaction. > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#16406) next »