PostgreSQL does row-level locking... But I'm more familiar with MySQL,
as I presume you are...
If you want to rely on MySQL's table locking, but are worried about a
user aborting the script, see:
http://www.php.net/manual/en/ref.misc.php
A combination of ignore_user_abort() and connection_aborted() will allow
you to determine if the user has aborted, and unlock the table
accordingly.
-----Original Message-----
From: Barry L. Jeung [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 17, 2001 3:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Application-based locking with PHP?
Just wondering if anyone has tried doing quasi application based locking
with PHP? My scenario is this. I'm constructing a database for my
company to help keep track of trouble tickets, etc with a web-based
frontend. I'm using PHP (obviously =]) for inputing/retrieving data and
have a slight predicament. Since MySQL does table-level locking, if I
put lock statements in my queries, it would cause two problems. One
being the entire table being locked and two if the user just closes the
webpage without exiting properly, the table would remain locked
indefinately. So I'm trying to think of alternatives, one of which is
using global variables to store table/record id's, and then evaluating
the queries based on that information. So if John selects ticket # 5 and
might be updating it, then when Bob attempts to select ticket #5, then
the $id and $table variables would be checked against the variables
stored when john placed his query, and bob would get a message saying
that record #5 is locked or in-use by John and to try later. Is this
feasible or is there a better way to do this? Thanks for your time.
--
PHP Database 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 Database 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]