保存到会话的物质 ID 是表中的最后一个记录 ID 我需要发送用户在编辑按钮上按下的行的记录 ID,每个按钮选择的记录 ID 是表中的最后一个记录 ID。此外,数据表脚本不起作用。
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
</head>
php
<div class="table-responsive">
<table class="table table-striped table-bordered" id="tableStock" style="width:100%">
<thead>
<tr>
<th>Substance Name</th>
<th>SubstanceCategory</th>
<th>Substance Quantity</th>
<th>Substance Price</th>
<th>Branch Location</th>
<th>Action</th>
</tr>
</thead>
<?php while($row=$data->fetch(PDO::FETCH_ASSOC) ) {
$_SESSION["Substance_ID"] = $row['Substance_ID'];
$_SESSION["Substance_Name"] = $row['Substance_Name'];
?>
<tr>
<td>
<?php echo $row['Substance_Name'];?>
</td>
<td>
<?php echo $row['Substance_Category']; ?>
</td>
<td>
<?php echo $row['Substance_Quantity']; ?>
</td>
<td>
<?php echo $row['Substance_Price']; ?>
</td>
<td>
<?php
if($row['Branch_ID']==0){
echo "Lebanon"; }
else{
echo "Syria";
}
?>
</td>
<td>
<a class="btn btn-success" href="updateSAtockItems.php" role="button">Update</a>
<a class="btn btn-danger" href="production.html" role="button">Delete</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
LEATH