Hi All,
I am creating a report using tables and nested "do... while..." loops. On the inside loop, I have only the <tr> that I want to loop set within the "do... while..." statements but for some reason I am still getting the header and footer rows and table caption looping. I believe it has something to do with the fact that this is a nested loop but I can't quite figure out how to fix it.
Any help is welcome and appreciated. Here is the code:
Thanks,
Ken
I am creating a report using tables and nested "do... while..." loops. On the inside loop, I have only the <tr> that I want to loop set within the "do... while..." statements but for some reason I am still getting the header and footer rows and table caption looping. I believe it has something to do with the fact that this is a nested loop but I can't quite figure out how to fix it.
Any help is welcome and appreciated. Here is the code:
PHP:
</TABLE>
<?php
$oldAirdate = "";
$oldDiscrepType = "";
$oldRecordNum = "";
do {
$newAirdate = $row_rstINIactivity['Airdate'];
$newDiscrepType = $row_rstINIactivity['DiscrepType'];
$newRecordNum = $row_rstINIactivity['tblOnAirActivityID'];
?>
<table align="left" style="clear:right" >
<tr>
<TD width="15%" ALIGN=RIGHT BGCOLOR=#FFFFFF ><I><FONT style=FONT-SIZE:12pt FACE="Calibri" COLOR=#000000><?php if ($oldAirdate <> $newAirdate) {echo $row_rstINIactivity['Airdate'];} ?></FONT></I></td>
<td width="10%"> </td>
<td width="75%"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<TD ALIGN=LEFT BGCOLOR=#FFFFFF ><U><FONT style=FONT-SIZE:11pt FACE="Calibri" COLOR=#000000><?php if ($oldDiscrepType <> $newDiscrepType) {echo $row_rstINIactivity['DiscrepType'] . "'s";} ?></FONT></U></I></TD>
</tr>
<tr <?php if ($oldRecordNum <> $newRecordNum) {echo "style='display: block'"; }else{ echo "style='display: none'";}?>>
<td> </td>
<TD ALIGN=left BGCOLOR=#FFFFFF ><B><I><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['DiscrepDetail']; ?> </FONT></I></B></TD>
<TD ALIGN=LEFT BGCOLOR=#FFFFFF ><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['Description']; ?></FONT></TD>
</tr>
<tr <?php if ($oldRecordNum <> $newRecordNum) {echo "style='display: block'"; }else{ echo "style='display: none'";}?>>
<td> </td>
<td> </td>
<TD ALIGN=LEFT BGCOLOR=#FFFFFF ><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['Resolution']; ?></FONT></TD>
</tr>
<tr <?php if ($oldRecordNum <> $newRecordNum) {echo "style='display: block'"; }else{ echo "style='display: none'";}?>>
<td> </td>
<td> </td>
<TD ALIGN=LEFT BGCOLOR=#FFFFFF ><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['Author']; ?></FONT></TD>
</tr>
</table>
<table id="vari" align="right" width="75%" border="0" <?php if ($row_rstINIactivity['OnAirVariance'] == -1) { echo "style='display: block'"; }else{ echo "style='display: none'";}?>>
<caption><FONT style=FONT-SIZE:11pt FACE="Calibri" COLOR=#000000>
Details of affected content:
</FONT></caption>
<tr>
<th align="left" width="15%" scope="col"><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000>Start Time:</FONT></th>
<th align="left" width="15%" scope="col"><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000>End Time:</FONT></th>
<th align="left" width="15%" scope="col"><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000>Material ID:</FONT></th>
<th align="left" width="40%" scope="col"><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000>Title:</FONT></th>
<th align="left" width="15%" scope="col"><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000>Length:</FONT></th>
</tr>
<?php
$parentRecordNum = $row_rstINIactivity['tblOnAirActivityID'];
do {
?>
<tr>
<td><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['StartTime']; ?></FONT></td>
<td><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['EndTime']; ?></FONT></td>
<td><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['MaterialID']; ?></FONT></td>
<td><FONT style=FONT-SIZE:9pt FACE="Calibri" COLOR=#000000><?php echo $row_rstINIactivity['Title']; ?></FONT></td>
<td></td>
</tr>
<?php
$childRecordNum = $row_rstAffectedProg['tblOnAirActivityID'];
} while (/*$row_rstINIactivity = mysql_fetch_assoc($rstINIactivity) && */ $parentRecordNum == $childRecordNum);
?>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<br/>
<?php
$oldAirdate = $row_rstINIactivity['Airdate'];
$oldDiscrepType = $row_rstINIactivity['DiscrepType'];
$oldRecordNum = $row_rstINIactivity['tblOnAirActivityID'];
}
while ($row_rstINIactivity = mysql_fetch_assoc($rstINIactivity)); ?>
Thanks,
Ken