update quantity with ajax only first one quantity is working

the only first quantity is updating when I click on second update button it also gives the same update_id as first update button but in inspect it has different id. I have a little knowledge about Ajax please suggest an easy way to do that.

cart-pic

cart.php

this is cart form this I send a request to actions.php it brings data from actions.php data is coming but only first quantity is working a cart is updating and database is updated but only first one it is not picking the second update button is showing same update id as the first button I think there is a little problem in it.

  <!-- Shoping Cart -->         <div id="products">          <div class="m-l-25 m-r--38 m-lr-0-xl" id="cart_msg">         <!--Cart Message-->          </div>          </div>  <script type="text/javascript">          $  (document).ready(function(){                  $  ("body").delegate(".update","click",function(event){             var update = $  (this).parent().parent().parent();             var update_id = update.find(".update").attr("update_id");             var qty = update.find(".qty").val();             $  .ajax({                 url :   "actions.php",                 method  :   "POST",                 data    :   {updateCartItem:1,update_id:update_id,qty:qty},                 success :   function(data){                     $  ("#cart_msg").html(data);                     // checkOutDetails();                 }             })         })      function net_total(){             var net_total = 0;             $  ('.qty').each(function(){                 var row = $  (this).parent().parent();                 var price  = row.find('.price').val();                 var total = price * $  (this).val()-0;                 row.find('.total').val(total);             })             $  ('.total').each(function(){                 net_total += ($  (this).val()-0);             })             $  ('.net_total').html("Total : $   " +net_total);         }       })  </script> 

actions.php

<?php     include 'include/db.php';     include 'cssFiles.php';      function getRealIpAddr()      {         if ( !empty( $  _SERVER['HTTP_CLIENT_IP'] ) )         {             $  ip = $  _SERVER['HTTP_CLIENT_IP'];         }         elseif( !empty( $  _SERVER['HTTP_X_FORWARDED_FOR'] ) )         //to check ip passed from proxy         {             $  ip=$  _SERVER['HTTP_X_FORWARDED_FOR'];         }         else         {             $  ip = $  _SERVER['REMOTE_ADDR'];         }         return $  ip;     }      if (isset($  _POST["checkOutDetails"])) {          echo'<form class="bg0 p-t-75 p-b-85" >         <div class="container">         <div class="row">         <div class="col-lg-10 col-xl-7 m-lr-auto m-b-50">         <div class="m-l-25 m-r--38 m-lr-0-xl">          <div class="wrap-table-shopping-cart">          <table class="table-shopping-cart" >         <tr class="table_head">                 <th class="column-1">Product</th>                 <th class="column-2"></th>                 <th class="column-3">Price</th>                 <th class="column-4">Quantity</th>                 <th class="column-5">Total</th>                 <th colspan="2"  style="text-align: center;" class="column-6">Action</th>                  </tr>                 ';          $  ip_add= getRealIpAddr();          $  total=0;          $  ip_add_query="select * from cart where ip_add='$  ip_add'";         $  result=mysqli_query(             $  conn,$  ip_add_query);         $  temp="";          while ($  ip_rows=mysqli_fetch_array($  result)) {              $  pro_id=$  ip_rows['id'];             $  qty=$  ip_rows['qty'];             $  get_id_query="select * from product where id='$  pro_id'";             $  run_query=mysqli_query(                 $  conn,$  get_id_query);              while ($  p_info=mysqli_fetch_array($  run_query)) {                  $  pro_price=array($  p_info['price']);                 $  p_info['name'];                 $  p_info['img1'];                 $  p_info['price'];                 $  p_id=$  p_info['id'];                  $  sum_price=array_sum($  pro_price);                  $  total +=$  sum_price;                   echo'                  <tr class="table_row">                 <td class="column-1">                 <input type="hidden" name="product_id[]" value="'.$  p_id.'"/>                 <input type="hidden" name="" value="'.$  pro_id.'"/>                 <div class="how-itemcart1">                 <img src="admin/img/'. $  p_info['img1'].'" alt="IMG">                 </div>                 </td>                 <td class="column-2">'. $  p_info['name'].'</td>                 <td class="column-3">"$  "'.$  p_info['price'].'</td>                 <td class="column-4">                 <div class="wrap-num-product flex-w m-l-auto m-r-0">                 <div class="btn-num-product-down cl8 hov-btn3 trans-04 flex-c-m">                 <i class="fs-16 zmdi zmdi-minus"></i>                 </div>                  <input class="mtext-104 cl3 txt-center num-product qty" type="number"  value="'.$  qty.'">                  <div class="btn-num-product-up cl8 hov-btn3 trans-04 flex-c-m">                 <i class="fs-16 zmdi zmdi-plus"></i>                 </div>                 </div>                 </td>                 <td class="column-5">$   36.00</td>                 <td class="column-6">                 <a href="#" update_id="'.$  pro_id.'" class="btn btn-primary btn-sm update">Update</a>                  </td>                  </tr>';                  }}              echo'</table>             </div>              <div class="flex-w flex-sb-m bor15 p-t-18 p-b-15 p-lr-40 p-lr-15-sm">             <div class="flex-w flex-m m-r-20 m-tb-5">             <input class="stext-104 cl2 plh4 size-117 bor13 p-lr-20 m-r-10 m-tb-5" type="text" name="coupon" placeholder="Coupon Code">              <div class="flex-c-m stext-101 cl2 size-118 bg8 bor13 hov-btn3 p-lr-15 trans-04 pointer m-tb-5">             Apply coupon             </div>             </div>              <!-- <button class="flex-c-m stext-101 cl2 size-119 bg8 bor13 hov-btn3 p-lr-15 trans-04 pointer m-tb-10" type="submit" name="submit">             Update Cart             </button> -->             </div>             </div>             </div>              <div class="col-sm-10 col-lg-7 col-xl-5 m-lr-auto m-b-50">             <div class="bor10 p-lr-40 p-t-30 p-b-40 m-l-63 m-r-40 m-lr-0-xl p-lr-15-sm">             <h4 class="mtext-109 cl2 p-b-30">             Cart Totals             </h4>              <div class="flex-w flex-t bor12 p-b-13">             <div class="size-208">             <span class="stext-110 cl2">             Subtotal:              </span>             </div>              <div class="size-209">             <span class="mtext-110 cl2">             $  79.65             </span>             </div>             </div>              <div class="flex-w flex-t bor12 p-t-15 p-b-30">             <div class="size-208 w-full-ssm">             <span class="stext-110 cl2">             Shipping:             </span>             </div>              <div class="size-209 p-r-18 p-r-0-sm w-full-ssm">             <p class="stext-111 cl6 p-t-2">             There are no shipping methods available. Please double check your address, or contact us if you need any help.             </p>              <div class="p-t-15">             <span class="stext-112 cl8">             Calculate Shipping             </span>              <div class="rs1-select2 rs2-select2 bor8 bg0 m-b-12 m-t-9">             <select class="js-select2" name="time">             <option>Select a country...</option>             <option>USA</option>             <option>UK</option>             </select>             <div class="dropDownSelect2"></div>             </div>              <div class="bor8 bg0 m-b-12">             <input class="stext-111 cl8 plh3 size-111 p-lr-15" type="text" name="state" placeholder="State /  country">             </div>              <div class="bor8 bg0 m-b-22">             <input class="stext-111 cl8 plh3 size-111 p-lr-15" type="text" name="postcode" placeholder="Postcode / Zip">             </div>              <div class="flex-w">             <div class="flex-c-m stext-101 cl2 size-115 bg8 bor13 hov-btn3 p-lr-15 trans-04 pointer">             Update Totals             </div>             </div>              </div>             </div>             </div>              <div class="flex-w flex-t p-t-27 p-b-33">             <div class="size-208">             <span class="mtext-101 cl2">             Total:              </span>             </div>              <div class="size-209 p-t-1">             <span class="mtext-110 cl2">                 "$  ".'.$  total.'         </span>     </div>     </div>      <button class="flex-c-m stext-101 cl0 size-116 bg3 bor14 hov-btn3 p-lr-15 trans-04 pointer">         Proceed to Checkout     </button>     </div>     </div>     </div>     </div>     </form>';       }       if (isset($  _POST["updateCartItem"])) {      $  ip_add= getRealIpAddr();     $  update_id = $  _POST["update_id"];     $  qty = $  _POST["qty"];      $  sql = "UPDATE cart SET qty='$  qty' WHERE id='$  update_id' AND ip_add = '$  ip_add'";      if(mysqli_query($  conn,$  sql)){     echo "<div class='alert alert-info'>         <a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a>         <b>Product is updated</b>     </div>";     exit();     }     }      ?>