Jump to content

planning


businessman332211@hotmail.com

Recommended Posts

I have already planned most of my database, but an entire, and very important section of the site, hasn't been planned yet. I am trying to set up something for categories, an idea for a database schema. I have a category, sub-category, and different settings for different types of posts. Meaning there are different things they input based on which category/sub-category they selected when posting an ad. It also shows different things when they are viewed, depending on which ones. Like they have a category, a sub-category, but each sub-category will need to accept different things.The thing I am trying to do, like for instance the category is items, the sub-category for instance would beItemsCouchesBedsDesksRefrigeratorsMicrowavesTVsAir ConditionersPosters/PaintingsDrawers/DressersChairsCDs/DVDsHouseholdElectronicsClothing/JewelrySee for items category they are all the samelikeo Item Title (Adjacent one line text box)o Price (Adjacent one line text box)o Description (Large text box below)that will cover 2 categories.Then I have this setup, for instance once category isAcademicsTextbooksNotesCheat SheetsNow the category, then the sub-categories.The textbooks will need information likeo Course number (Adjacent one line text box)o Title of book (Adjacent one line text box)o Price (Adjacent one line text box)Then the notes/cheat sheets will needo Item Title (Adjacent one line text box)o Description (Large text box below)You see, so different categories/subcategories need different things, and on some of them there might be a category, then each sub-category is going to need information, I am having a hard time coming up with a good database schema, can someone offer some advive, personal input something like that.I am thinking about1. individual tables for each thing I need2. Making one big table that will have categorysubcategorythen all the fields there, and it will only fill in the related fields, and only pull the related fields(I think this will be too hard to manage/create),I have to do this to where I can still update it, and change things around later, maybe add more later, or refine them, or change them around, Ihave to start this system off right int he planning stage before I can start building it.Sporting GoodsComputer/AccessoriesBikesCollectiblesEventsTicketsConcertsSportsClubsPartiesCharity EventsBar specialsPoker TournamentsLost and FoundItems foundItems lostRentalsSubletsParking

Link to comment
Share on other sites

Okhere is what I have, I just want input/advice on how well you think it'll be to mantainok first off, as I said, I have categories, sub-categories, then those sub-categories sometimes have sub-sub categories, each sometimes needing different information for them.ok here is hte current plan I have for my schema, I just have to write up the specifics for itTable Number 1This will have by category id. I will have the name of the category and category idTable Number 2I will have a sub-category name, sub-category id, and the category id from the category it is associated with.Table Number 3This contains all the sub-sub categories. It has the sub-sub category name, the sub-sub category id, the sub-category, and category id's associated with it. Other tablesI have 1 different table for each type of specs. Like I might have a table that has typenamedescriptionthen one that haspricetypedescriptionaddresswhatever, then in those tables have the cat, sub-cat, sub-sub-cat, associated with itAll of this here is making sense but it seems to be getting a little too hairy near the end, any advice?

Link to comment
Share on other sites

I think there is a simpler way you can go about this. How about a schema resembling the following

Categories------------CategoryIDCategoryNameParentID
Then, have the first entry in your database be a "global" category that acts as a parent for all the primary categories, and simply references itself as the ParentID. All other primary categories would have the global category as their ParentID, and subcategories would have the regular CategoryID, like so:
CategoryID | CategoryName | ParentID--------------------------------------------------1		  | Global	   | 12		  | Category A   | 13		  | Category B   | 14		  | Category A-1 | 25		  | Category B-1 | 36		  | Category A-2 | 2

I also think you may be able to simplify the process of having a different table for every single type of product as well, although that may be a slightly different problem. I think you need to find several (2-4) categories everything on your site would fit into and create a table for each. Then use optional or text fields to hold the details of each item - although as a database admin, this solution seems a bit "dirty," storing each product's detailed information as a serialized PHP class may provide a much easier solution than creating a database with 30+ tables...

Link to comment
Share on other sites

Things are different I clarified some thingsthere are categories, sub-categories and some information for the sub-categories, but that is mostly the same for most of the categories.so any ideas, I saw what you said, I am confused and wondering, what do you mean, people keep saying parent/child, I understand the concept but not in relation to databasing??

Link to comment
Share on other sites

I finally came up with something I can work with, that'll be easy to put the programmind as wellTables relating to PostscategoryinformationCategorynameSubcategorynameSETSIn this website I am using sets as a basis for the posts. A general set is a group of related information, and different categories may be set to different sets, it’s the set name, the fields needed within the set, at the bottom it is a list of what things go with what sets. In case if anyone but me ever works on this website, in the future.postset1Related subcats- everything under the item and event categoriesCategorynameSubcategorynameUseridPostidItem TitlePriceDescriptionpostset2Related subcats- lost items only under found categoryCategorynameSubcategorynameUseridPostidItem TitleRewardDescriptionpostset3Related subcats- found items only under found categoryCategorynameSubcategorynameUseridPostidItem TitleDescriptionPostset4Related subcats- everything under the rental categoryCategorynameSubcategorynameUseridPostidItemTitlePriceNumberOfUnitsDescriptionPostset5Related subcats- Everything under the work offered BY students categoryCategorynameSubcategorynameUseridPostidItem TitleWageDescriptionPostset6Related subcats- everything under the work offered TO students categoryCategorynameSubcategorynameUseridPostid ItemTitleWageHoursPerWeekDescriptionPostset7CategorynameSubcategorynameUseridPostidCourse numberTitleAuthorPrice

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...