MySQL Forums
Forum List  »  PHP

Re: An efficient way to implement this......
Posted by: Chis Florinel
Date: September 10, 2005 03:00AM

"bit puzzled as to how i can implement the users database that will contain users posts, and comments made about the posts. "

Your user table should be something like:

Table users:
user_id (PK, auto_increment)
username
user_password
email
....
"My current idea is to have individual tables for each user and store their data in there" - I don't think is such a good idea.

Posts table:
post_id (PK, auto_increment)
user_id (FK, index)
post_title
post_content
post_date (date_time, index)
//....

Comments:
comment_id(PK, auto_increment)
post_id (FK, index)
user_id (index) #the user who inserts the comment, if anyone can post comments, ignore it
comment_date (date_time, index)
comment_content

Now, if you will have a large database (milions of posts and comments), extra optimization should be added. For that post later, or check phpBB db design...

Options: ReplyQuote


Subject
Written By
Posted
September 09, 2005 07:45AM
Re: An efficient way to implement this......
September 10, 2005 03:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.