Well, I have a MySQL Database with the following structure:
Basically, from that information I need a function that can do something like this with output in HTML:PHP Code:category
--------------
id | name | description | orderby
------------------------------------
1 | first | first ones | 1
2 | second | second ones | 2
subcategory
--------------
id | name | description | orderby | parent
--------------------------------------------
1 | games | All games | 1 | -1
2 | movies | All movies | 1 | 1
3 | people | All people | 1 | 2
4 | music | All music | 2 | 2
Basically, the orderby column in both tables (category, subcateogry) dictates in which order they will go in; 1,2,3 etc.PHP Code:---------------------------------------------
|Games (Lone category/subcategory) |
---------------------------------------------
|First (Category) |
---------------------------------------------
|Movies (Subcategory of First) |
---------------------------------------------
|Second (Category) |
---------------------------------------------
|People (Subcategory of Second) |
---------------------------------------------
|Music (Subcategory of Second) |
---------------------------------------------
The parent column in the subcategory table is the id number of a category, in which subcategories would go into. If this value of parent equals "-1" then it has no category and is in fact a lone subcategory/category, that will display normally ordered by the orderby function.
It is sort of like the way a vBulletin and other forum software works in displaying forums and categories.
Any help is appreicated,
Thanks.





Bookmarks