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
https://forums.phpfreaks.com/topic/173808-how-to-structure-this-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.