php while循环表重复修复

时间:2016-08-24 04:26:34

标签: php mysql

我有以下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>

我试图修复但不适合我

1 个答案:

答案 0 :(得分:0)

在内部循环中,您需要增加计数器变量 内部循环添加此行

$counter++;