Jump to content

creating posts category


nielcleo
 Share

Recommended Posts

If you want to store categories and posts in a database, then you need a table for each, a table for categories and a table for posts. Each table needs an ID, you need a category ID and a post ID, plus any other fields you want to keep track of. The posts table should have a field for the category ID, which says which category the post is in. If you want to have categories inside categories, then the categories table should have a field for the parent category ID. If that field is 0 then the category doesn't have a parent, or else it has the ID of the parent category.

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
 Share

×
×
  • Create New...