You are here: Re: How do I handle people going into the same record at the same in web app. « PHP Programming Language « IT news, forums, messages
Re: How do I handle people going into the same record at the same in web app.

Posted by Chung Leong on 12/18/12 11:48

rich wrote:
> Someone gave me even a better idea. Use sessions in a table. Add to
> each user session a field for the Key field of each table in your
> database that is important. Example use the key field for a customer
> record. When you query the record for a change, write to that customer
> field in your seesion table the index of the record you are on.
> Whenever anyone opens that record, the ffirst thingyou do is query for
> the record number you are going to change and if it is found you cannot
> select the record because someone else has it open. Set your session
> max life time low enough so that a user can't sit on a record too long.
> This saves a person alot of work entering data only to be told someone
> else was using the record. I think this is a nice way of doing it.

That's a very bad idea. Whoever recommended it doesn't have a good
understanding of PHP's session garbage collection mechanism. There is
no timer somewhere that causes a session to become expired. Instead,
garbage collection *could* happen at the end of every request, with the
probability of it happening determined by session.gc_probability /
session.gc_divisor (in php.ini). The default is one in a hundred. If
site traffic is low, your record would be locked for many times the
session max life. Setting the probability to unity, on the other hand,
would be serious drag on performance/scalability.

There is nothing clever at all about the idea. It's just a locking
mechanism. You can easily implement a proper one without a custom
session handler.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация