title: how to get row value with ajax triggered by onchange dropdown?
body: <p>I tried to update 1 row in table with ajax triggered by onchange dropdown, I succeed update data but it updating all data in my table.</p>
  
  <p>so how I can get unique value (eg :User ID) to pass it from ajax to my php so i can update it only 1 row?</p>
  
  <p>here's my code : </p>
  
  <p>my table (transactions.php)</p>
  
  <pre><code>&lt;table class="table table-bordered table-hover table-striped"&gt;
     &lt;thead&gt;
        &lt;tr&gt;
           &lt;th&gt;User ID&lt;/th&gt;
           &lt;th&gt;Pengirim&lt;/th&gt;
           &lt;th&gt;Jumlah Transfer&lt;/th&gt;
           &lt;th&gt;Berita Acara&lt;/th&gt;
           &lt;th&gt;Status&lt;/th&gt;
           &lt;th&gt;Rincian&lt;/th&gt;
        &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt;
        &lt;?php
           $query = mysqli_query($koneksi, "select * from konf_transf order by tanggal desc limit 7 ");
           while($data1 = mysqli_fetch_array($query)){
              ?&gt;
        &lt;tr&gt;
           &lt;td&gt;
              &lt;center&gt;&lt;?php echo $data1['usr_id']; ?&gt;&lt;/center&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;center&gt;&lt;?php echo $data1['nm_pengirim']; ?&gt;&lt;/center&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;center&gt;Rp. &lt;?php echo number_format($data1['jmlh_transf'],0,'','.'); ?&gt;,-&lt;/center&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;center&gt;&lt;?php echo $data1['berita_acara']; ?&gt;&lt;/center&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;center&gt;&lt;?php echo $data1['status']; ?&gt;&lt;/center&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;center&gt;
                 &lt;select name="pilihstatus" id="pilihstatus" onchange="updatetransactions();"&gt;
                    &lt;option value="Pilihan"&gt;Pilihan&lt;/option&gt;
                    &lt;option value="Sudah"&gt;Sudah&lt;/option&gt;
                    &lt;option value="Belum"&gt;Belum&lt;/option&gt;
                 &lt;/select&gt;
              &lt;/center&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;?php } ?&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>and here my ajax</p>
  
  <pre><code>function updatetransactions(){
    var id = $('select option:selected').val();  
  $.ajax({
              type:"post",
              url:"updatestatustransaksi.php",
              data:"status="+id,
              success:function(data){
                  alert('Successfully updated mysql database');
              }
          });
      }
  </code></pre>
  
  <p>my updatestatustransaksi.php</p>
  
  <pre><code>&lt;?php
  require_once("koneksi.php");
  session_start();
  if (!isset($_SESSION['username'])) {
      echo "&lt;script&gt;alert('You must register an account first, we will redirect you to register page !'); window.location = 'registuser.php'&lt;/script&gt;";
  }
  $dataupd = $_POST["status"];
  $query   = mysqli_query($koneksi, "UPDATE `konf_transf` SET `status` = '$dataupd' WHERE `id` = '$penjualan_id'");
  if ($query) {
      echo "&lt;script&gt;alert('Update Success.'); window.location = 'transactions.php' &lt;/script&gt;";
  } else {
      echo "&lt;script&gt;alert('Update Failure.'); window.location = 'transactions.php' &lt;/script&gt;";
  }
  </code></pre>