Profile Comments, how to needed

I made a successful user profile script, but now I need comments. I need individual comments, but I fear that I need a new table for each profile. How do I make profile comments? Thanks in advance.

Hi,

I’m not really sure what you’re trying to do.
You have profiles, now you want to attach comments to profiles.

I’d say you’ll need a new table for the comments, not for the profiles because you already have that working.
To ‘attach’ them you put a field in the comment-table in which you store the ID of the profile it was posted by.

If this wasn’t what you meant, you may want to elaborate the question a bit.

Good luck,
O.

Example Table: profile_comments

comment_id | profile_id | user_id | comment

comment_id = auto-incrementing primary key.
profile_id = profile the comment is on.
user_id = person who posted the comment
comment = text

Thanks, but say I have 5 users with profile comments. Wouldn’t having one table mean that they all have the same exact comments as each other? If not, why? I need more descriptive than a code itself (but codes do help me visualize, though I like to try to do complete scrap) Thanks!

Ok, I kind of understand know. This would be an example table, right? (This is not in SQL format)

TABLE NAME: [whatever I want]
Columns:
commentID
profileID? (unsure since I have that in a different table)
poster
comment

I do have a question. There’s only room for one comment, so how would the following work?

MiniCode110
Just finished my new comment system!

X.Ample
Nice! I like it!

MiniCode110
Thanks!

Only the first comment would appear, right? How do I get more than one comment to appear?

You can insert unlimited rows to your table. I’m assuming you have a users table which has a userid as the primary key. Here’s the flow of how posting would work:

Person A goes to Person B’s profile page.
Person A Writes a comment which sends into a form and the flow is this
commentID = Null (automatically generates in mysql)
profileID = Person B’s userid
poster = person A’s userid
comment = text.

Now when you goto page all you do is search for any comments where profileID = id of the person who’s page you are viewing. Example:
Person A returns to Person B’s page after commenting. The database would do a search for any comments which have profileID as Person B’s id. It will then show these to the user by your php script.

Sponsor our Newsletter | Privacy Policy | Terms of Service