我的代码:
while($row = mysqli_fetch_assoc($result)){
$fullname = $row['full_name'];
$roll = $row['roll'];
$s_result = $row['result'];
$gm = $row['gm'];
echo "<tr>";
echo "<th scope='row'>1</th>";
echo "<td>{$fullname}</td>";
echo "<td>{$roll}</td>";
echo "<td>{$s_result}</td>";
echo "<td>$gm</td>";
echo "</tr>";
}
我想增加所选的号码。现在是硬编码的。如何动态地增加数字?如果我输入更多的数据,那么我希望数字会自动增加。
2条答案
按热度按时间xiozqbni1#
你只需要做一点加法:
baubqpgj2#
你需要在上面取一个全局变量
while
循环并将其初始化为1
然后按原样打印并在每次迭代中增加,它将按序列号打印。