devknob Posted June 30, 2007 Share Posted June 30, 2007 I have a table with all of my user/profile info in it, but I need to allow a comments box per user where anyone can come by and leave a blurb. Should I just have a record of the username being commented on to identify which comments belong to which username in a query? Or is there a better way im overlooking... Thanks Link to comment https://forums.phpfreaks.com/topic/57797-users-comments/ Share on other sites More sharing options...
bubblegum.anarchy Posted June 30, 2007 Share Posted June 30, 2007 If there is only every going to be one comment per user than add a field to the profile table named comment otherwise create a separate table something like: comment.user_id comment.date_created comment.comment Link to comment https://forums.phpfreaks.com/topic/57797-users-comments/#findComment-286420 Share on other sites More sharing options...
skali Posted July 2, 2007 Share Posted July 2, 2007 You should use another table with comment_id int not null primary key user_id int not null, comment text not null This way user_id will be the id of the user for whom the comment is being posted and any number of users can post comments to this user. Also if you want to keep track of which users left comments then you will have to introduce another field with id's of the users posting comment. Hope this will help. Link to comment https://forums.phpfreaks.com/topic/57797-users-comments/#findComment-288169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.