If I have a piece of code like this:
$get_categories = mysql_query("SELECT * FROM categories");
$categories = mysql_fetch_assoc($get_categories);
The category table contains all the different categories and their sub categories and their sub categories etc.
How can I make some php code which generate a list like this:
Main Category
-Sub Category
- -Sub Sub Category
- -Sub Sub Category
- - -Sub Sub Sub Category etc
-Sub Category
Main Category
A list of all categories and their sub categories and their sub categories and so on.
I cannot see how I am able to do with without making a while loop for each sub category level (which is stupid as I would then have to create 50 levels to make sure it works with if I have 50 levels of sub categories).
I hope I make sense.
Thanks
This should help you out; http://codeassembly.com/How-to-display-inifinit-depth-expandable-categories-using-php-and-javascript/.