Hi,
What I am trying to do, is have a header for my records, and then if there are no records under that specific header, the header is not shown. Here is my code:
$sql2 = "select * from corporate_writs WHERE COURT = 'VICTORIA' AND published = 'NO' ";
$result2 = mysql_query($sql2);
echo " <tr><td valign=\"top\" class=headers>VICTORIA";
echo " <td valign=\"top\"></td>";
echo " <td valign=\"top\"></td>";
echo " <td valign=\"top\">";
echo "</td></tr>";
while ($south = mysql_fetch_array($result2)) {
$COURT=$south['COURT'];
$FILE=$south['FILE'];
$DEFNAME=$south['DEFNAME'];
$AMOUNT=$south['AMOUNT'];
$PLAINNAME=$south['PLAINNAME'];
$COMM=$south['COMM'];
$TYPE=$south['TYPE'];
$DEFTRADE=$south['DEFTRADE'];
$id=$south['id'];
$date=$south['date'];
$published=$south['published'];
echo "<a href=\"corporate_writs.php?id=$id&task=edit\"><tr onMouseOver=\"this.className='over'\" onMouseOut=\"this.className='out'\" class=\"out\">";
echo " <td valign=\"top\">$DEFNAME";
echo " <td valign=\"top\">$PLAINNAME</td>";
echo " <td valign=\"top\">$AMOUNT</td>";
echo " <td valign=\"top\">$FILE";
echo "</td></tr></a>";
}
$sql2 = "select * from corporate_writs WHERE COURT = 'DUNCAN' AND published = 'NO' ";
$result2 = mysql_query($sql2);
echo " <tr><td valign=\"top\" class=headers>DUNCAN";
echo " <td valign=\"top\"></td>";
echo " <td valign=\"top\"></td>";
echo " <td valign=\"top\">";
echo "</td></tr>";
while ($south = mysql_fetch_array($result2)) {
$COURT=$south['COURT'];
$FILE=$south['FILE'];
$DEFNAME=$south['DEFNAME'];
$AMOUNT=$south['AMOUNT'];
$PLAINNAME=$south['PLAINNAME'];
$COMM=$south['COMM'];
$TYPE=$south['TYPE'];
$DEFTRADE=$south['DEFTRADE'];
$id=$south['id'];
$date=$south['date'];
$published=$south['published'];
echo "<a href=\"corporate_writs.php?id=$id&task=edit\"><tr onMouseOver=\"this.className='over'\" onMouseOut=\"this.className='out'\" class=\"out\">";
echo " <td valign=\"top\">$DEFNAME";
echo " <td valign=\"top\">$PLAINNAME</td>";
echo " <td valign=\"top\">$AMOUNT</td>";
echo " <td valign=\"top\">$FILE";
echo "</td></tr></a>";
}
With this code, everything works fine, except when i have no records under tha header, the header is still showing, any ideas???