From one to several relationships (one post can have many comments), so you will need a new table for it.
comments_tbl
- comment_id | int(11) auto_increment
- post_id | int(11) (FK to post table)
- author_id | int(11) (FK to the user table OR author_name)
- date | datetime
- comment | text
And if you want to be able to tag and notice comments, you can include something like:
- date_approved | datetime
- flagged | int(1)
Then your SQL to display comments for the message will look like
mysql_query("SELECT comment_id, author_name, comment FROM comments_tbl WHERE post_id = '$postid' AND date_approved IS NOT NULL AND flagged = '0'");
:
mysql_query("INSERT INTO comments (post_id, author_id, date, comment) VALUES ('$postid', '$author_id', '$date', '$comment');