title: mysql 'FOR UPDATE' command not working correctly
body: <p>I have two php page, page1.php &amp; page2.php</p>
  
  <h2>page1.php</h2>
  
  <pre><code>execute_query('START TRANSACTION');
  $res =execute_query('SELECT * FROM table WHERE id = 1 FOR UPDATE');
  
  sleep(20);
  
  print $res-&gt;first_name;
  execute_query('COMMIT');
  
  print"\n OK";
  </code></pre>
  
  <h2>page2.php</h2>
  
  <pre><code> $res =execute_query('SELECT * FROM table WHERE id = 1');
  print $res-&gt;first_name;
  </code></pre>
  
  <p>I executing both pages almost same time</p>
  
  <p>So according to the mysql 'FOR UPDATE' condition,the result in page2.php will display only after the execution of page1.php (ie after display 'OK' in page1.php), because both page reading same row.</p>
  
  <p>But what is happening is, </p>
  
  <p>page2.php suddenly display the result, even before completing the execution of page1.php</p>
  
  <p>May i know whats wrong with ' FOR UPDATE' command.?</p>