title: Update Database from Javascript onClick By Ajax PHP
body: <p>Hi i want to update id row when a user click the button below please help and sorry for my bad english</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;a href="javascript:void(0)" onClick="updateId('1')"&gt;Id 1&lt;/a&gt;
  &lt;a href="javascript:void(0)" onClick="updateId('2')"&gt;Id 2&lt;/a&gt;
  &lt;a href="javascript:void(0)" onClick="updateId('3')"&gt;Id 3&lt;/a&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>update.php</p>
  
  <pre><code>&lt;?php 
  include('database_connection.php');
  
  $update = "UPDATE id SET id = id + 1 WHERE id = updateId";
  
  if (mysqli_query($connect, $update)) {
      echo "Record updated successfully";
  } else {
      echo "Error updating record: " . mysqli_error($connect);
  }
  ?&gt;
  </code></pre>