Re: [PHP] locking a mysQL row

2001-09-11 Thread nayco

Try to insert in your 'locked' field an Unix date  instead of 'locked' .
One field, two effects 



(°-Nayco,
//\[EMAIL PROTECTED]
v_/_ http://nayco.free.fr


- Original Message -
From: Justin French [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Tuesday, September 11, 2001 3:48 AM
Subject: [PHP] locking a mysQL row


 Hi all,

 I'm currrently developing a dynamic, user-added content site.
 The thing is, content can be added and edited my TWO people..
 the original writer, and the editor.

 So, my problem is, if the editor/user makes an edit to content
 whilst the other is also attempting to do so, one of them will
 get overwritten.


 This isn't the end of the world, but it's a bit of a problem
 i'd like to clear up.


 So, my initial thought was to add a new column to the code
 locked with a time that the code can be re edited.

 1. when the user requests to edit the content, the
program first makes sure any locked time has
expired.

 2. he/she is given a time limit (say 10 minutes) to
edit and re-submit, during which time the annother
user cannot edit or change the content.

 3. when the user submits the edited content, the
locked timestamp is deleted, so that the content
can be re-edited earlier than the 10 minutes.

 4. if the user submits after the 10 minutes, they
are rejected, since the content may have been
edited by annother user.


 Does this seem like a good move?  Can any one offer any firther
 tips or a smarter way to do this?



 Thanks
 Justin French

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] locking a mysQL row

2001-09-10 Thread Justin French

Hi all,

I'm currrently developing a dynamic, user-added content site.
The thing is, content can be added and edited my TWO people.. 
the original writer, and the editor.

So, my problem is, if the editor/user makes an edit to content 
whilst the other is also attempting to do so, one of them will 
get overwritten.


This isn't the end of the world, but it's a bit of a problem 
i'd like to clear up.


So, my initial thought was to add a new column to the code 
locked with a time that the code can be re edited.

1. when the user requests to edit the content, the 
   program first makes sure any locked time has 
   expired.

2. he/she is given a time limit (say 10 minutes) to 
   edit and re-submit, during which time the annother 
   user cannot edit or change the content.

3. when the user submits the edited content, the
   locked timestamp is deleted, so that the content
   can be re-edited earlier than the 10 minutes.

4. if the user submits after the 10 minutes, they
   are rejected, since the content may have been
   edited by annother user.


Does this seem like a good move?  Can any one offer any firther 
tips or a smarter way to do this?



Thanks
Justin French

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] locking a mysQL row

2001-09-10 Thread tjacobs-php

On Tue, 11 Sep 2001, Justin French wrote:

 I'm currrently developing a dynamic, user-added content site. The
 thing is, content can be added and edited my TWO people..  the
 original writer, and the editor.

Just put a timestamp field into the table, which will automatically track
the last update of that row.  Prior to doing a write, lock the table, and
then compare the timestamp at retrieval time to the current timestamp. If
it's identical, write the data and unlock. Otherwise, display an error and
unlock, or do whatever else you want to do to handle the error.

-- 
Work: It's not just a job, it's an indenture.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]