好吧,我实际上不知道问题出在哪里,但是我的模态没有获得我选择的行的 ID。
我的模态需要获取所选行的描述。因此,如果您在我的表中选择第 2 行,您需要在我的数据库中获取 ID 2 的描述。
<tr data-toggle='modal' value=".$row["ID"]." data-target='#myModal' id=".$row["ID"].">
<td>" . $row["ID"]. "</td>
<td>" . $row["Name"]. " </td>
<td>" . $row["Category"]. " </td>
<td>" . $row["Skill"]. " </td>
<td>" . $row["CareerCompetence"]. " </td>
<td>" . $row["DateAdded"]. " </td>
<td>" . $row["EmailUploader"]. " </td>
<td> ";
?>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<?php
$sql2 = "SELECT * FROM class where ID='".$row['ID']."'";
$result2 = $con->query($sql2);
while($row2 = $result2->fetch_assoc()) {
?>
<h4 class="modal-title"><?php echo $row2["Name"]; ?></h4>
</div>
<div class="modal-body">
<p><?php echo $row2['Descriptie'];?></p>
<p><?php echo $row2['FileName'];?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
至尊宝的传说