SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Denmark
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Database design for dynamic content

    Hi folks,
    I'm trying to design a DB to accomodate page content to be output through 'templates'.
    I've come up with a nice two table system for this but if I want to have different 'sections' in my site using different fields in the table concerned Should I have a DB for each section (say product reviews, articles etc) or is there a way to keep it all in the same DB.

    How is this normally achieved?
    Can anyone show me an example?

    Below is the schema for my two table system(good for one 'section':

    CREATE TABLE head (page_id SMALLINT(4) UNSIGNED NOT NULL AUTO_INCREMENT, prev SMALLINT(4) UNSIGNED NULL, date DATE NOT NULL, title VARCHAR(60) NOT NULL, keywords VARCHAR(150) NOT NULL, description VARCHAR(150) NOT NULL, PRIMARY KEY(page_id));

    CREATE TABLE content (page_id SMALLINT(4) UNSIGNED NOT NULL AUTO_INCREMENT, headline VARCHAR(150) NOT NULL, subhead VARCHAR(150) NOT NULL, text TEXT NOT NULL, PRIMARY KEY(page_id));


    Cheers

    Nick
    Nick Wilson

  2. #2
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its really upto you, having seperate tables would be handy but if you dont want to do that have a section field in your database then you can set up the SQL statment to only show content from a certain section

    Edit:

    Sorry I cant help with the code I have only used Access
    Last edited by sbdi; Jun 2, 2001 at 07:01.
    Back Again


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •