Jump to content

How to structure this database.


gevans

Recommended Posts

Hey guys,

 

I've done a similar database to this before, but I think I over complicate things. I'm trying to think of the cleanest way to do this, wanted to see what you guys think...

 

The website has a 3 level hierachy, and example would be;

 

home -> who we are -> history

 

Each of these pages will have it's own content (also stored in the database).

 

My first thought was to only use two tables... `pages` and `content`. `content` would be easy, with the page's id assigned to it. For `pages` I was going to put an extra couple of id fields in it;

 

`id` - referenced by `content`

`title` - usual stuff

`level` - an integer to represent the hierachical level of the page (2 for the first sub nav)

`order` - for ordering pages

`parent` - parent id, or NULL if its top of the hierachy

 

Am I missing something, or is there a better way of doing this?

 

Cheers,

gevans

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.