mysql - php while loop table repeating fix -


i have following while loop keep on repeating table each record how fix it? full table repeat each record. every row fetch can add

<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> 

i tried fix not working me

inside loop need increment counter variable inside loop add line

$counter++; 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -