coldfingertips has asked for the wisdom of the Perl Monks concerning the following question:
I'm making a link management system which I know upfront I can do 99% of the work. The part that boggles me is how some scripts allow infinite categories (and infinite categories DEEP!). How is it possible to set up infinite levels of categories for each link?
I started going this route and using the URL as a common field to relate to another table. That's fine and dandy, I can give a single url a million different categories this way. But I'm not sure how to make categories have categories of their own, especially since the end user will create the levels via a web form during configuration.my $sth = $dbh->prepare( "CREATE TABLE IF NOT EXISTS categories ( id int auto_increment NOT NULL, url VARCHAR(300) NOT NULL, primary key (id) )"); $sth->execute();
Some sample data:
As shown above, there are multiple levels of sub categories for the major categories. I am totally confused at where to start. This will be a MySQL database.Large Animals - Small Animals - Ocean Life - 4-legged - 4-legged - Under 12" - 2-legged - 2-legged - 12" - 3' - *invertebrate *carnivore *herbavore
My guess is I'd have one table categories for all the first-level categories. Then I could create tables for every single next-level category saving the information of the categories it relates to in each of them. But THAT seems wrong and definitely a waste.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: database table advice
by aufflick (Deacon) on Mar 27, 2007 at 02:15 UTC | |
|
Re: database table advice
by whereiskurt (Friar) on Mar 27, 2007 at 02:02 UTC | |
|
Re: database table advice
by jhourcle (Prior) on Mar 27, 2007 at 04:47 UTC |