Try this:
If you are using a table handler in MySQL that doesn't support transactions, you must use LOCK TABLES if you want to ensure that no other thread comes between a SELECT and an UPDATE. The example shown below requires LOCK TABLES in order to execute safely: mysql> LOCK TABLES trans READ, customer WRITE; mysql> select sum(value) from trans where customer_id= some_id; mysql> update customer set total_value=sum_from_previous_statement where customer_id=some_id; mysql> UNLOCK TABLES; Without LOCK TABLES, there is a chance that another thread might insert a new row in the trans table between execution of the SELECT and UPDATE statements. From: http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#LOC K_TABLES ----- Original Message ----- From: "Hayan Al Mamoun" <[EMAIL PROTECTED]> To: "MYSQL MAILING LIST (E-mail)" <[EMAIL PROTECTED]> Sent: Monday, January 28, 2002 7:21 AM Subject: Table Lock > Hi, Is there a way to lock a table so that only one user can change it and > then unlockit? > I need to do this coz I want visitors to retrieve some values from a > database but each value must be retrieved only by one user and then marked > up to be expired, so I don't want two users to retrieve the same value > Any suggestions > > Best Regards > Hayan > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php