nested repeat regions
Hi I wonder if you can help?
I have been playing around with nested repeat regions and dont seem to be able to make it work. The page should display multiple invoices and each invoice should contain multiple products. I checked some of the other posts but couldn't find anything similar. Thanks
Here is the code for the page in question
<?php
// RepeatSelectionCounter_2 Begin Loop
$RepeatSelectionCounter_2_IterationsRemaining = $RepeatSelectionCounter_2_Iterations;
while($RepeatSelectionCounter_2_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_2 || $row_Recordsetmultiprint){
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" colspan="6"><table width="100%" border="0">
<tr>
<td width="30%"><form id="form1" name="form1" method="post" action="">
<div align="right">
<input name="logo" type="image" id="logo" src="<?php echo $row_Recordsetmultiprint['companylogo']; ?>" align="right" />
</div>
</form> </td>
<td width="64%"><div align="right"><?php echo $row_Recordsetmultiprint['compnameadd']; ?></div></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="3">
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td width="10%" nowrap="nowrap"> </td>
<td width="10%" nowrap="nowrap">Invoice Date:</td>
<td width="83%" nowrap="nowrap"><?php echo $row_Recordsetmultiprint['printdate']; ?></td>
</tr>
<?php if ($totalRows_Recordsetdisplayinvoiceid > 0) { // Show if recordset not empty ?>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap">Invoice Number:</td>
<td nowrap="nowrap"><?php echo $row_Recordsetmultiprint['invoiceid']; ?></td>
</tr>
<?php } // Show if recordset not empty ?>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"><strong>Account Ref:</strong></td>
<td nowrap="nowrap"><strong><?php echo $row_Recordsetmultiprint['customerid']; ?></strong></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap">To:</td>
<td nowrap="nowrap"><?php echo $row_Recordsetmultiprint['cust_name']; ?></td>
</tr>
<tr>
<td valign="top" nowrap="nowrap"> </td>
<td valign="top" nowrap="nowrap">Address:</td>
<td nowrap="nowrap"><?php echo $row_Recordsetmultiprint['cust_houseno']; ?> <?php echo $row_Recordsetmultiprint['cust_street']; ?></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"><?php echo $row_Recordsetmultiprint['district']; ?></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"><?php echo $row_Recordsetmultiprint['town']; ?></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"><?php echo $row_Recordsetmultiprint['postcode']; ?></td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"><div align="center" class="style2">
<div align="left">Invoice</div>
</div></td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="8%"> </td>
<td><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td nowrap="nowrap"><div align="left"><?php echo $row_Recordsetmultiprint['title1']; ?></div></td>
<td nowrap="nowrap"><div align="left"><?php echo $row_Recordsetmultiprint['title2']; ?></div></td>
<td nowrap="nowrap"><div align="left"><?php echo $row_Recordsetmultiprint['title3']; ?></div></td>
<td nowrap="nowrap"><div align="right"><?php echo $row_Recordsetmultiprint['title4']; ?></div></td>
<td nowrap="nowrap"><div align="right"><?php echo $row_Recordsetmultiprint['title5']; ?></div></td>
</tr>
<tr>
<td colspan="5" nowrap="nowrap"><hr /></td>
</tr>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_Recordsetdisplayproducts){
?>
<tr>
<td nowrap="nowrap"><?php echo $row_Recordsetdisplayproducts['product1']; ?></td>
<td nowrap="nowrap"><?php echo $row_Recordsetdisplayproducts['product2']; ?></td>
<td nowrap="nowrap"><?php echo $row_Recordsetdisplayproducts['product3']; ?></td>
<td nowrap="nowrap"><div align="right"><?php echo $row_Recordsetdisplayproducts['product4']; ?></div></td>
<td nowrap="nowrap"><div align="right"><?php echo $row_Recordsetdisplayproducts['product5']; ?></div></td>
</tr>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_Recordsetdisplayproducts && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_Recordsetdisplayproducts = mysql_fetch_assoc($Recordsetdisplayproducts);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
</tr>
</table>
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><hr /></td>
</tr>
<tr>
<td><?php echo $row_Recordsetmultiprint['notes']; ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><div align="justify"><?php echo $row_Recordsetmultiprint['invoicetxtcomm']; ?></div></td>
</tr>
</table></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="6" valign="top"> </td>
</tr>
<tr>
<td colspan="6" valign="top"> </td>
</tr>
<tr>
<td colspan="6" valign="top"><hr /></td>
</tr>
<tr>
<td colspan="6" valign="top"><hr /></td>
</tr>
</table>
<?php
} // RepeatSelectionCounter_2 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_2 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_2 && $RepeatSelectionCounter_2_IterationsRemaining != 0){
if(!$row_Recordsetmultiprint && $RepeatSelectionCounter_2_Iterations == -1){$RepeatSelectionCounter_2_IterationsRemaining = 0;}
$row_Recordsetmultiprint = mysql_fetch_assoc($Recordsetmultiprint);
}
$RepeatSelectionCounter_2++;
} // RepeatSelectionCounter_2 End Loop
?>