How to lock selected rows from reading in other session?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • salsan
    New Member
    • Nov 2012
    • 12

    How to lock selected rows from reading in other session?

    How to block selected rows from reading in other session unless unlock it?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Salsan,
    You need to provide a little more detail as to how you are accessing the database.

    Comment

    • salsan
      New Member
      • Nov 2012
      • 12

      #3
      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.

      Comment

      • wholetthedogout
        New Member
        • Nov 2012
        • 6

        #4
        Can u please put in the code u tried so far.

        Thank you.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          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.

          Comment

          • salsan
            New Member
            • Nov 2012
            • 12

            #6
            Code:
            LOCK TABLE email_list WRITE;
            
            SELECT * FROM email_list LIMIT 10;
            
            INSERT INTO .....
            
            UNLOCK TABLES;
            This is the query i have used in that.
            Last edited by zmbd; Nov 28 '12, 11:40 AM. Reason: [Z{Please use the <CODE/> button in the toolbar to format posted code/SQL}]

            Comment

            Working...