Msg#: 10529 posted 7:34 am on Oct 18, 2005 (gmt 0)
I started programming a way to list all my projects in a data base. Each project belongs to a category and a subcategory. All the code below is my implementation of only 3 categories and 1 subcategory. As you can see, it is starting to get out of hand :)
By the time i add all 10 categories and each subcategory having 10 more subcategories each, that will be over 100 switch cases and they are already starting to confuse me. I cant think of any other way to set this up. I dont know or want to learn oop and was hoping there would be a procedural way of handling it.
Is the way i am doing normal and should i just keep going or is there a better way?
[edited by: coopster at 7:34 pm (utc) on Oct. 18, 2005] [edit reason] removed code dump [/edit]
Msg#: 10529 posted 9:24 am on Oct 18, 2005 (gmt 0)
Yeah, the normal method is to store all the categories in some form of database (either an RDMS like MySQL, or even in an array with PHP) and use this information to then dynamically generate the list. It's not recommended to hand-write the entire list.