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 Quote 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 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/57797-users-comments/#findComment-288169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.