Page 1 of 1

Databse creation

Posted: Fri Aug 05, 2011 12:16 pm
by janpan
hi guys , I need to create a database to use with a website where users create/delete and share posts. I would like to know what do you think would be the best way to create the database.
E.g. There should probably be a db with a table for users , posts etc. and if so , how do I go about in linking the 2 , e.g. linking the user with his posts ?

I am writing the whole website from scratch and want to start of in the right direction.

T.I.A.

Re: Databse creation

Posted: Fri Aug 05, 2011 12:40 pm
by social_experiment
janpan wrote:how do I go about in linking the 2 , e.g. linking the user with his posts ?
Foreign keys. Simple example:
----------------------------------
user_tbl
----------------------------------
id, user_id, name

---------------------------------
post_tbl
---------------------------------
id, post_id, user_id

If a user makes a post, his id (user_id) is placed inside the post table.

Re: Databse creation

Posted: Sat Aug 06, 2011 3:03 am
by janpan
Awesome ! Helps a lot .

Thx