Php 获取单击的按钮表行值以更新数据库

Php 获取单击的按钮表行值以更新数据库,php,jquery,html,mysql,Php,Jquery,Html,Mysql,我在那里有一个web项目,我从数据库中获取数据,并在表中显示它们,以编辑和更新数据库。表结构相同。可能有多个表,也可能只有一个表。这是一种变化 每个表行都有一个按钮,用于将更新的数据发送到数据库。我的问题是我无法识别按钮。我正在单击哪个按钮。更改数据后,我希望单击按钮并更新数据库中的该行 我的代码 我正在根据名为“议程”的字段循环该部分。每个议程都有一张桌子。因此,可能有一个或多个议程。每个表都有不同的ID。I增量表ID <?php $mCount = 0; while

我在那里有一个web项目,我从数据库中获取数据,并在表中显示它们,以编辑和更新数据库。表结构相同。可能有多个表,也可能只有一个表。这是一种变化

每个表行都有一个按钮,用于将更新的数据发送到数据库。我的问题是我无法识别按钮。我正在单击哪个按钮。更改数据后,我希望单击按钮并更新数据库中的该行

我的代码

我正在根据名为“议程”的字段循环该部分。每个议程都有一张桌子。因此,可能有一个或多个议程。每个表都有不同的ID。I增量表ID

<?php 

    $mCount = 0;
    while ($row = mysqli_fetch_assoc($agenda_result)) {
    $myCount = ++$mCount;

  ?>

  <section class="color">

      <h1 class="agenda_head"> <?php echo trim($row['agenda_name']); ?> </h1>

      <?php 

      $agnd_id = $row['agenda_id'];

      $get_tbl_data = $db->prepare("SELECT distinct mType, mDivision, discuss_point, mAction, statDate, dueDate, status, user_tbl.fName FROM meeting_i_tbl inner join user_tbl on meeting_i_tbl.responsible_id = user_tbl.user_id WHERE meeting_i_tbl.meeting_id = ? and meeting_i_tbl.agenda_id = ?");
      $get_tbl_data->bind_param("ss",$selected_meet_id,$agnd_id);
      $get_tbl_data->execute();
      $tbl_data_result = $get_tbl_data->get_result();    

      ?>

      <center><table class="responstable" id="responstable_tbl<?php echo $myCount; ?>" name="res_tbl_name<?php echo $myCount; ?>"> 
      <tr>
      <th>Type</th>
      <th>Division</th>
      <th>Discuss Points</th>
      <th>Action</th>
      <th>Start Date</th>
      <th>Due Date</th>
      <th>Status</th>
      <th>Res: Person</th>
      <th></th>
      </tr>

      <?php


      while ($row_res = mysqli_fetch_assoc($tbl_data_result)) {


      ?>

      <tr>
      <td> <?php echo trim($row_res['mType']); ?> </td>
      <td> <?php echo trim($row_res['mDivision']); ?> </td>
      <td> <?php echo trim($row_res['discuss_point']); ?> </td>
      <td> <?php echo trim($row_res['mAction']); ?> </td>
      <td><input type="text" class="datepickerClass" value="<?php echo trim($row_res['statDate']); ?>" placeholder="Meeting Date"/></td>
      <td><input type="text" class="datepickerClass" value="<?php echo trim($row_res['dueDate']); ?>" placeholder="Due Date"/></td>

      <td class="select_op_div">

      <select name="status" class="select_option">
        <option<?php if ($row_res['status'] == "1"): ?> id="1" selected="selected"<?php endif; ?>>Pending</option>
        <option<?php if ($row_res['status'] == "2"): ?> id="2" selected="selected"<?php endif; ?>>On Going</option>
        <option<?php if ($row_res['status'] == "3"): ?> id="3" selected="selected"<?php endif; ?>>Completed</option>
        <option<?php if ($row_res['status'] == "4"): ?> id="4" selected="selected"<?php endif; ?>>-</option>
      </select>

      </td>

      <td class="nr"> <?php echo trim($row_res['fName']); ?> </td>
      <td>
      <form action='detailform.php' method='POST'>
      <input type='submit' onclick="row_update()" name='btn_update' value='up'/>
      </form>
      </td>
      </tr>

      <?php

      }   

      ?>
      </table></center>

  </section>

<div style="height: 25px;">
</div>

<?php

}

mysqli_close($db);
$myCount = 0;
?>
我也尝试过这种方法

   $("#responstable_tbl tr").click(function(){

    });

可以在onclick函数中传递行id,如函数row_update(); 函数行\更新(行ID){ 警报(rowid); 您的更新数据id在这里 }); }
很抱歉,我的英语不好。

这应该能帮你排好队。它起作用了……那么好吗?”111111111111111'
   $("#responstable_tbl tr").click(function(){

    });