Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-25-2002, 11:03 PM   PM User | #1
Fletcher
New Coder

 
Join Date: Jul 2002
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Fletcher is an unknown quantity at this point
Article based website

What's the best way to structure a database for an article based website? I want to have multiple categories and multiple languages. Also, how do you do multiple page articles? Thank you for any help. All I need are abstract answers. I can develop it on my own.
Fletcher is offline   Reply With Quote
Old 07-26-2002, 07:10 AM   PM User | #2
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
Designing a database properly can take some time but it's really not too difficult and will save you time in the long run. This is what I do for a living.

The best way to start is by doing a brainstorm. Let's say I want to design a relational database for a video store. First thing to do is to think of ways to describe a video store and how it operates using nouns and then list them. For example:

customers
employees
dvd
vhs tape
games
prices
commissions

the list can go on. Once you have thought of everything you can start thinking how these nouns are related. Make sentences out of it for example:

Customers rent DVD's
Employees get commissions

Once you have come up with all possible relationships begin putting an ER diagram together. An Entity Relationship Diagram is a necessity for designing the database. The ER diagram essentially is the sketch of the structure of your database. In this case an Entity would be the nouns in your list. Those Entitys/Nouns become the tables in your database. The sentences that describe the relationship between the nouns become the relationships between the Entities.

To generate the attributes/columns of each table simply think about the noun and make a list of words that describe the noun. For examples:

What does a dvd have:

title
rating
category
year

These can become attributes of that entity.

The process is much more involved as this was just a simple and quick example. The best way is to read through some tutorials or buy a good book on database design. Here are some links:


http://www.islandnet.com/~tmc/html/a...s/datamodl.htm

http://folkworm.ceri.memphis.edu/ew/...arison/erd.htm

http://www.utexas.edu/cc/database/da...m/erintro.html

http://www.surfermall.com/relational/lesson_1.htm

http://www.webmasterbase.com/article/378

There are many tutorials available so just do a search on

database design

data modelling
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 07-30-2002, 04:15 PM   PM User | #3
xajckop
New to the CF scene

 
Join Date: Jul 2002
Location: belgrade, serbia
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
xajckop is an unknown quantity at this point
article based website

first of all, do not store languages at your db! all language switching do thru php script:
switch($lang) {
case 'lang01':
... do this
break;
case'lang02':
... do that
break;
...
}
just to simplify your queries.
next, separate tables for articles from themes:
theme [table]
idTheme ...,
theme ...,

articles [table]
articleID,
title,
description,
text,
date,
time,
source,
themeID,
pictureID,
userID,
...

pictureID if you want pictures with your articles (of course, create table to store PATH to pictures , add (or remove) userID field if you want to keep tracks of your user actions (if several people have privileges to enter the articles)

hth
xajckop is offline   Reply With Quote
Old 08-02-2002, 09:27 PM   PM User | #4
Fletcher
New Coder

 
Join Date: Jul 2002
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Fletcher is an unknown quantity at this point
And as for languages, shouldn't I still make my articles table like this:

title_lang1
title_lang2
body_lang1
body_lang2
author
lang2_translator
etc?

Then use PHP to pick the appropriate ones?

Last edited by Fletcher; 08-02-2002 at 10:15 PM..
Fletcher is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:01 PM.


Advertisement
Log in to turn off these ads.