...

View Full Version : Table repeat region adding extra <tr>



MaDmiX
10-11-2012, 06:36 PM
Hi All,

I have this code to repeat a table region while records exist in my recordset:

<table width="100%" border="0">
<tr>
<?php
$oldAirdate = "";
$oldDiscrepType = "";
do {
$newAirdate = $row_rstINIactivity['Airdate'];
$newDiscrepType = $row_rstINIactivity['DiscrepType'];
?>
<td align="left" width="15%"><?php if ($oldAirdate <> $newAirdate) {echo $row_rstINIactivity['Airdate'];} ?></td>
<td width="15%">&nbsp;</td>
<td width="55%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?php if ($oldDiscrepType <> $newDiscrepType) {echo $row_rstINIactivity['DiscrepType'] . "'s";} ?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><?php echo $row_rstINIactivity['DiscrepDetail']; ?></td>
<td><?php echo $row_rstINIactivity['Description']; ?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?php echo $row_rstINIactivity['Resolution']; ?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?php echo $row_rstINIactivity['Author']; ?></td>
<?php
$oldAirdate = $row_rstINIactivity['Airdate'];
$oldDiscrepType = $row_rstINIactivity['DiscrepType'];
}
while ($row_rstINIactivity = mysql_fetch_assoc($rstINIactivity)); ?>
</tr>
</table>


The first loop iteration works fine and my table looks good but when it loops through again, the data from my first table column is appearing all the way to the right. When I view the page source it seems that some extra cells are being added, pushing this cell over. Here's part of the page source:


<table width="100%" border="0">
<tr>
<td align="left" width="15%">2011-10-04</td>
<td width="15%">&nbsp;</td>
<td width="55%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Equipment issue's</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>VTR6</td>
<td>@ 8:30 AM VTR 6 had a head clog causing the program JM9422 to ripple on Air.</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Operator punched up Black and ejected JM9422 out of VTR 6 and switched it to VTR 5 and hot punched VTR 5 to Air. As a result of the transition INI expereinced Approx 20 sec of black on Air. To correct the timing descripnacy operator deleted 20 sec promo 52500028. Also operator cleaned VTR 6 for future airing and notified engineering and Supervisor.</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td align="left" width="15%">2011-10-08</td>
<td width="15%">&nbsp;</td>
<td width="55%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Media issue's</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Missing media</td>
<td>INI Programs VT067 & NWC 1076 are missing for Tuesday</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Per Scheduling</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td align="left" width="15%">2011-10-12</td>
<td width="15%">&nbsp;</td>
<td width="55%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>


I don't know what could be causing this. Can anyone help?

Thanks,

Ken

poyzn
10-11-2012, 06:52 PM
place tr-tag inside the do-loop

MaDmiX
10-12-2012, 07:17 PM
Thanks poyzn,

That did the trick.

Ken



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum