So I am working on a category management script, and I am trying to figure out how to select subcategories of each category and display those subcategories under their main category.
No problem with that, but, how can I also display the subcategories of the subcategories, and the subsubb categories of the subsub categories ( as deep down as the category system goes )
The top level categories use an empty CATEGORY field, and the subcategories use the ID from the parent category... hope somone can point me in the right direction.
Thanks
-Arron
$SQL = "SELECT * from TABLE WHERE CATEGORY = '$nothing' ORDER BY TITLE ASC"; $result = @mysql_query( $SQL );
while( $row = @mysql_fetch_array( $result ) ) {
echo "<b>$row[TITLE]</b><br>";
$SQL = "SELECT * from TABLE WHERE CATEGORY = '$row[ID]' ORDER BY TITLE ASC"; $result = @mysql_query( $SQL );
while( $row = @mysql_fetch_array( $result ) ) {
echo "<b>$row[TITLE]</b><br>";
}
}