我真的不知道最好的表达方式,所以我会尽力描述我想要实现的目标。我有一个像这样的表格内的表格
<form action="manager-match-report-run.php" method="post" autocomplete="off" name="registerForm">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Goals</th>
<th>Assists</th>
<th>Match Rating</th>
<th hidden>playerId</th>
</tr>
</thead>
<tbody>
<?php
$sql_players = "SELECT * FROM Player WHERE teamId = '$teamId' AND selected = '1'";
$res_players = mysqli_query($conn, $sql_players);
while($row_players = $res_players->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row_players["firstName"]. "</td>";
echo "<td>" . $row_players["lastName"]. "</td>";
echo "<td><div class='form-group'><input name='goals' class='form-control py-4' type='number'/></div></td>";
echo "<td><div class='form-group'><input name='assists' class='form-control py-4' type='number'/></div></td>";
echo "<td><div class='form-group'><input name='matchRating' class='form-control py-4' type='number' step='0.01' min='0' max='10'/></div></td>"
?>
<td hidden><input name="playerId" value="<?php echo $row_players['playerId'];?>"></td>
<?php echo "</tr>";
}?>
</tbody>
</table>
</div>
我正在寻找将数据插入 Player 表中正确行的正确方法。例如,更新球员表,使 Alison 有 5 个进球、1 个助攻、8 个比赛评分,Ben 有 0 个进球、1 个助攻、7 个比赛评分等。
我假设我必须使用某种循环,但到目前为止还没有运气,所以任何帮助或建议都会很棒,谢谢:)
紫衣仙女
相关分类