Not quite sure how to explain this properly but here goes.....
Im trying to render lists within other lists using php/mysql.
So for exaple I want to end up with a page looking like this:
Category 1
___Page 1
Page 2
___Page 3
Category 2
___Page 1
Page 2
___Page 3
Category 3
___Page 1
___Page 2
and so on. The same way as this page: http://www.phpbuilder.com/board/index.php. Like generating the forums lists within category's lists.
Thisis the code I have tried to use:
// SEARCH QUERY FOR CATEGORYS -------------------------------------------
$GetCat = "SELECT * FROM category";
$ResultList = mysql_query($GetCat) or die ("problem with query:".mysql_error());
$TableRows = mysql_num_rows($ResultList);
// SEARCH QUERY FOR CATOGORYS -------------------------------------------
$GetPages = "SELECT * FROM pages";
$ResultForums = mysql_query($GetPages) or die ("problem with query:".mysql_error());
$PageRows = mysql_num_rows($ResultPage);
echo "<table border=\"1\">\n";
$i = 0;
while ($i < $TableRows)
{
$cid = mysql_result($ResultList,$i,"CAT_ID");
$cstatus = mysql_result($ResultList,$i,"CAT_STATUS");
$cname = mysql_result($ResultList,$i,"CAT_NAME");
$corder = mysql_result($ResultList,$i,"CAT_ORDER");
// LIST CATEGORYS ------------------------------------------------
echo "<tr><td><i>$cid</i> <b>$cname</b></td></tr>\n";
echo "<tr><td>\n";
// LIST PAGES------------------------------------------------
echo "<table border=\"1\">\n";
$i = 0;
while ($i < $PageRows)
{
$pid = mysql_result($ResultPage,$i,"PAGE_ID");
$psubject = mysql_result($ResultPage,$i,"P_SUBJECT");
$pdesc = mysql_result($ResultPage,$i,"P_DESCRIPTION");
echo "<tr><td>$pid - $psubject<br>pfdesc</td></tr>\n";
$i++;
}
echo "</table>\n";
// END LIST PAGES-------------------------------
echo "</td></tr>\n";
$i++;
}
echo "</table>\n";
(I know the code is a little rough, but im just testing at this stage)
But with this code whats happening is, its displaying
Category 1 as it should, then its displaying the pages list within category 1.....
but then it stops!
It doesnt go on to display category 2 ot any of its lists or other categorys.
Perhaps it isnt possible to have list within another list like I have tried to do?