title: MySQL concurrency Control
body: <p>I am developing a custom news editorial CMS with PHP, MySQL and CSS. Multiple users will use this application. So I would like to lock articles while someone else editing theme.  </p>
  
  <ol>
  <li>How do I lock articles while editing (using php)</li>
  <li>Notify the other user that someone is editing this article</li>
  </ol>
  
  <p>.....</p>
  
  <pre><code>$id=$_GET['id'];  
  $query="SELECT * FROM storyproposal WHERE id={$id} FOR UPDATE";
  $result=mysqli_query($connection,$query);
  $story = mysqli_fetch_array($result);
  </code></pre>
  
  <p>......
               
                   Initial Headline: 
                           ">
                   </p>
  
  <pre><code>             &lt;div class="form-group"&gt;
               &lt;label for="possibleIssues" &gt;Possible Issues the story touches Upon: &lt;label&gt;
              &lt;textarea rows="8" cols="40" id="possibleIssues" name="possibleIssues" class="form-control"&gt;&lt;?php echo $story['possibleIssues']; ?&gt;&lt;/textarea&gt;
               &lt;/div&gt;
  
               &lt;div class="form-group"&gt;
               &lt;label for="initialLead" &gt;Initial Lead: &lt;label&gt;
              &lt;textarea rows="8" cols="60" id="initialLead" name="initialLead" class="form-control"&gt;&lt;?php echo $story['initialLead']; ?&gt;&lt;/textarea&gt;
               &lt;/div&gt;
  </code></pre>
  
  <p>.........</p>