MySQL Forums
Forum List  »  PHP

I've Problem in Locking and unlocking of table.
Posted by: venkat .
Date: May 19, 2009 01:53AM

Hi, I've Problem in Locking and unlocking of table.

<?php
mysql_query("LOCK TABLES table_name WRITE");
mysql_query("select * from table_name")
mysql_query("UPDATE table_name SET user_name='myname' WHERE id=1")
exit;
mysql_query("UNLOCK TABLES");
?>

I loged-in as user1 and locked the table. By using exit keyword i prevented to unlock it.

Now i loged-in as user2(user1 session is still exists).

It's allowing the user2 to execute "select and update" query even though the table is still locked by user1. This should not happen right?

Options: ReplyQuote


Subject
Written By
Posted
I've Problem in Locking and unlocking of table.
May 19, 2009 01:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.