Ok, well in this code, I attempt to get all the articles that are associated to a category and display them under the category heading. As you can see at,
http://madtast.com?page=viewall it shows the heading more then ounce, I would like the heading to only be shown one time, with a listing of all the categories, if anyone has any better code, or ideas then the following example, I would be very greatfull, I just want this to work. ALL SUGGESTIONS ARE WELCOME...
CODE
<div id="scrollbox">
<?php
$vAll = mysql_query('SELECT * FROM categories');
//if (! $vAll) { print "Bad query: " . mysql_error(); }
while($row = mysql_fetch_array($vAll))
{
$cId = $row['id'];
$cName = $row['name'];
$vAll1 = mysql_query("SELECT article_id FROM article_categories WHERE category_id = ".$cId." LIMIT 1");
//if (! $vAll1) { print "Bad query: " . mysql_error(); }
while($row1 = mysql_fetch_array($vAll1))
{
$ivaArticle = mysql_query("SELECT * FROM articles WHERE id=".$row1['article_id']." LIMIT 10");
//if (! $ivaArticle) { print "Bad query: " . mysql_error(); }
if(mysql_num_rows($ivaArticle) == 0) { $brZero = 0; }
else { echo '<font><ul class="menu">'.$cName.'</font><hr class="hrMenu">'; $brZero = 1; }
while($row2 = mysql_fetch_array($ivaArticle))
{
$AdHeading = $row2['title'];
$AdArticleId = $row2['id'];
if($AdArticleId != $article_id)
{
echo('<li class="mItem"><a href="?read='.$AdArticleId.'">'.$AdHeading.'</a></li> ');
}
}
if($brZero == 0) { }
else { echo '<br><br></ul>'; }
}
}
?>
</div>