working on a little problem here during my print out i get the table headers every single time and the bottom is never printed.
UPDATE: the title now prints out as it is supposed to but the footer prints out to many times it is only supposed to print out once per category not once per result. i got the title and table to print out once per category but am finding it difficult to master the same with the bottom of the table.
///start result//
$result = mysql_query($sql) or die("Query failed($sql): " . mysql_error());
/// logic to handle the last category ///
$last_cat = '';
/// first counter for row colours///
$i = 0;
/// second counter for row colours ///
$m = 0;
/// start loop///
WHILE ($row = mysql_fetch_array($result)) {
/// if statement for handleing category rows///
if($row['category'] != $last_cat) {
$last_cat = $row['category'];
////The title of the block element (the catagory)////
printf( "<div class=\"title\"><h3>%s" . "</h3></div>", $row["category"]);
}
/// printing the rest of the table////
print "<div class=\"content\"><div class=\"content_text\">";
/// if statement for handleing category rows///
if($row['category'] != $tableish) {
$tableish = $row['category'];
////The title of the block element (the catagory)////
print '<table width="100%" border="0" cellpadding="2" cellspacing="2" >';
print '<tr class="page_title"><td width="50%">Forum</td><td width="10%">Topics</td><td width="10%">Replies</td><td width="30%">Last Posted by</td></tr>';
}
if($i++ % 2)
{
print '<tr class="wight">';
}
else
{
print '<tr class="other">';
}
printf("<tr><td><a href=\"forum_topic.php?id=%s&title=%s\">%s</a>" . "</td><td>%s" . "</td><td>%s" . "</td><td>%s" . "</td></tr>", $row["id"], $row["title"], $row["title"], $row["topiccount"], $row["replycount"], $row["lastpost"]);
/// the second row colour changer ////
if($m++ % 2)
{
print '<tr class="wight">';
}
else
{
print '<tr class="other">';
}
printf("<td><font size=\"-1\">%s" . "</font></td><td></td><td></td><td><font size=\"-1\">%s" . "<br /><a href=\"forum_topic_view.php?catagory=%s&title=%s&id=%s\">%s</a>" . "</font></td></tr>", $row["about"], $row["lastposttime"], $row["id"], $row["title"], $row["lastid"], $row["lasttopic"]);
/// finish the table ///
//////////bit that needs to only be printed ones per catagory////
print '</table></div></div>';
print '<div class="bottom_content"><div class="btm_text">Add me</div></div>';
}