Jump to content

Like / Dislike buttons


The Little Guy

Recommended Posts

I am adding like/dislike buttons to my comments section, and am not sure how I should do this.

 

I have two thoughts:

1. have a like/dislike table that holds all likes and dislikes

2. have a column in the comments table that holds the number of likes and a column with number of dislikes.

 

I am liking #1 the best, it seems more practical and modifiable. What do you think? I also want to place on the top of the comments section the best rated comment.

 

What do you think I should do (#1, #2 or other)?

Link to comment
Share on other sites

I'd have a table called "Likes"  that held a row for each like and dislike, that stored the like or dislike as boolean (0 for dislike) and a column for UserID and a column for CommentID. How many likes or dislikes per comment should be derived from how many rows have that comment id in it's CommentID and has a 0 or 1

Link to comment
Share on other sites

Either would be good,

 

I personally would make my own table and store the CID (Comment ID) L and D (Like and Dislike) as a boolean variable, then PID (Person ID) to keep track of if people are flaming your comments. The only problem with this, is that the server has to add up all the likes and dislikes, however, as long as your site doesn't have a huge overhead, you should be fine.

Link to comment
Share on other sites

The way I'd do it is for everything posted on my application, it gets a unique id # for each item. Then my table fields would be item_id, (item contents, etc), is_likeable.

 

If the is_likeable is true, then you can have a second "likes" table with the fields: item_id, likes, user_like, dislikes, user_dislike. That way you can tell who liked/disliked which item.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.