gpt4 book ai didi

php while循环表重复修复

转载 作者:行者123 更新时间:2023-11-29 20:30:14 24 4
gpt4 key购买 nike

我有以下 do while 循环,它会继续为每条记录重复表,如何修复它?每条记录重复全表。另外,对于每一行提取,我可以添加

<table width="1510" border="1" align="center" cellpadding="2" cellspacing="2"  class="table table-bordered" >
<tbody>
<form name="f1">
<? $counter = 1;
$total_marks = 0;
$total_obtain = 0;
while($row_rsDept = mysql_fetch_array($rsDept))
{
if($counter === 1)

{
?>
<tr>
<th width="71" rowspan="3" align="center" valign="middle" scope="col"><h4>Sr. No</h4></th>
<th width="229" align="right" valign="top" scope="col">&nbsp;</th>
<th colspan="8" align="center" valign="middle" scope="col"><h3>Detail of Marks</h3></th>
</tr>

<tr>
<th rowspan="2" align="left" scope="row"><h4>Subject</h4></th>
<td colspan="2" align="center"><h4>Thoery</h4></td>
<td colspan="2" align="center"><h4>Practical</h4></td>
<td width="134" rowspan="2" align="center" valign="middle"><h4>Marks Obtain</h4></td>
<td width="144" rowspan="2" align="center" valign="middle"><h4>Max Marks</h4></td>
<td width="137" rowspan="2" align="center" valign="middle"><h4>Remarks</h4></td>
<td width="137" rowspan="2" align="center" valign="middle"><h4>Grace Marks</h4></td>
</tr>

<tr>
<td width="134">Obtained Marks</td>
<td width="144">Total Marks</td>
<td width="143">Obtained Marks</td>
<td width="153">Total Marks</td>
</tr>
<? } ?>
<tr>
<th align="left" scope="row">&nbsp;</th>
<th align="left" scope="row"><?php echo $row_rsDept['SUBJECTS']; ?></th>
<td><?php echo $row_rsDept['THEORYOBTAINEDMARKS']; ?></td>
<td><?php echo $row_rsDept['THEORYTOTALMARKS']; ?></td>
<td><?php echo $row_rsDept['PRACTICALOBATINEDMARKS']; ?></td>
<td><?php echo $row_rsDept['PRACTICALTOTALMARKS']; ?></td>
<td align="center" valign="middle"><?php echo $row_rsDept['MARKSOBTAINED']; ?></td>
<td align="center" valign="middle"><?php echo $row_rsDept['MAXMARKS']; ?></td>
<td align="center" valign="middle"><span class="style8"><?php echo $row_rsDept['REMARKS']; ?></span></td>
<td align="center" valign="middle"><?php echo $row_rsDept['GRACEMARKS']; ?></td>
</tr>

<tr>
<th colspan="6" align="right" valign="middle" scope="row"><h4>Total</h4></th>
<td align="center" valign="middle"><span class="style8"><?php echo $row_rsDept['TOTALMARKS']; ?></span></td>
<td align="center" valign="middle">=total of above ( )</td>
<td align="center" valign="middle">&nbsp;</td>
<td align="center" valign="middle">&nbsp;</td>
</tr>

<?php
} ?>

<tr>
<th colspan="10" align="left" valign="middle" scope="row">&nbsp;</th>
</tr>
<tr>
<th colspan="8" align="left" valign="middle" scope="row">&nbsp;</th>
<th align="left" valign="middle" scope="row">&nbsp;</th>
<th align="left" valign="middle" scope="row">&nbsp;</th>
</tr>
<tr>
<th colspan="8" align="left" valign="middle" scope="row"><br></th>
<th align="left" valign="middle" scope="row">&nbsp;</th>
<th align="left" valign="middle" scope="row">&nbsp;</th>
</tr>

</form>
</table>

我尝试修复但不适合我

最佳答案

在循环内您需要增加计数器变量在循环内添加这一行

$counter++;

关于php while循环表重复修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39114424/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com