By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,510 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,510 IT Pros & Developers. It's quick & easy.

How to lock selected rows from reading in other session?

P: 12
How to block selected rows from reading in other session unless unlock it?
Nov 27 '12 #1
Share this Question
Share on Google+
5 Replies


zmbd
Expert Mod 5K+
P: 5,397
Salsan,
You need to provide a little more detail as to how you are accessing the database.
Nov 27 '12 #2

P: 12
Its for a multithreaded php application accessing mysql database from each instance. Whenever one instance is accessing the database the table must get locked from accessing other instances and other instances should wait till the lock release.
Nov 27 '12 #3

P: 6
Can u please put in the code u tried so far.

Thank you.
Nov 27 '12 #4

zmbd
Expert Mod 5K+
P: 5,397
The code would be nice.

IMHO: this doesn't seem like a MySQL issue in as much as it is how PHP is opening the recordset and how the servers handle PHP actions.

I can move this thread to the PHP forum if you'd like.
Nov 27 '12 #5

P: 12
Expand|Select|Wrap|Line Numbers
  1. LOCK TABLE email_list WRITE;
  2.  
  3. SELECT * FROM email_list LIMIT 10;
  4.  
  5. INSERT INTO .....
  6.  
  7. UNLOCK TABLES;
This is the query i have used in that.
Nov 28 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.