Hey all,
First off thanks for offering this forum for those of us trying to come to grips with this powerful language.\
I am trying to create a PHP report that queries a MySQL DB and returns lists of matching records, ordered by a date field, with each date’s records in it’s own table.
I have gotten quite far, and all works as it should except, I need a main and sub heading above each table in addition to the column headings.
My current code displays all the headings first then the table like such:
HEADING1.1
HEADING1.2
HEADING2.1
HEADING2.2
table 1 column headings
table 1 data 1
table 1 data 2
table 2 column headings
table 2 data 1
table 2 data 2
table 2 data 3
What I need is:
HEADING1.1
HEADING1.2
table 1 column headings
table 1 data 1
table 1 data 2
HEADING2.1
HEADING2.2
table 2 column headings
table 2 data 1
table 2 data 2
table 2 data 3
My code is as follows:
[php]<?php $tmpdate = ''; ?>
Register of Control Documents - <?php echo $_SESSION['laName']; ?>
<?php echo "COURT: POTCHEFSTROOM NO:C COURTDATE " . $row_rsoffence['courtdate'] ; ?>
<table width="950px" border="1" cellpadding="1" cellspacing="1" >
<tr>
<td>Court Date</td>
<td>Officer</td>
<td>Notice / Summons No.</td>
<td>Name of Accused</td>
<td>How Disposed Of</td>
<td>Signature: Remove Control Doc</td>
</tr>
<?php } ?>
<tr>
<td><?php echo $row_rsoffence['courtdate']; ?></td>
<td><?php echo $row_rsoffence['officerno']; ?></td>
<td><?php echo $row_rsoffence['noticeno']; ?></td>
<td><?php echo $row_rsoffence['offenderforenames'] . ' ' . $row_rsoffence['offendername'] ; ?></td>
<td></td>
<td></td>
</tr>
<?php $tmpdate = $row_rsoffence['courtdate']; ?>
<?php } while ($row_rsoffence = mysql_fetch_assoc($rsoffence)); ?>
</table>