title: Increment id on click in MySQL
body: <p>I have a problem to visualize the solution for the problem that I have now.</p>
  
  <p>The user is allowed to insert a row in a table.</p>
  
  <p>And I try to display a button (input) +1 who allow the user to increment a column (vote) in a selected row among all created.</p>
  
  <p>The problem is that I don't get the thing for rely incrementation to the desired id.</p>
  
  <p>Here my code :</p>
  
  <pre><code>      &lt;form action="" method="post"&gt;
  
          &lt;input type="text" name="disease"&gt;name  
  
          &lt;input name="mainsubmit" type="submit" value="submit"&gt;
  
       &lt;/form&gt;
  
   &lt;/body&gt;
   &lt;/html&gt;
  
  
  
  &lt;?php
  
  if(isset($_POST['mainsubmit']))
  {
  
  $nameDisease = $_POST['disease'];
  
  
  $req = $db-&gt;prepare('INSERT into disease(name) VALUES(:name)');
  
  $req-&gt;execute(array('name' =&gt; $nameDisease));
  
  }
  
  $query = $db-&gt;query('SELECT * FROM disease');
  
  while ($result = $query-&gt;fetch())
  {
      $id = $result['id']; 
      echo $id ?&gt;
      &lt;form action="" method="post"&gt; &lt;input name="secondsubmit"            type="submit" value="+1"&gt; &lt;/form&gt;&lt;?php
  
      if(isset($_POST['secondsubmit']))
  {
  
  $db-&gt;exec("UPDATE disease SET vote = vote + 1 WHERE id = " .$id);
  
  
  }
  
  }
  </code></pre>
  
  <p>Logically, the code above doesn't work but I don't understand how find the solution.</p>
  
  <p>In brief, i want to allow the user to increment a column in a selected row.</p>
  
  <p>Thanks</p>
  
  <p>Edit: <strong>Shadow</strong>, it's not my problem because your solution is used for automatically chose between INSERT or UPDATE if the line doesn't exist or exist. Me, I want allow the user to create rows and allow he to vote +1 on each of one that exist, and it will not be possible for he to insert a row from the input +1.</p>