Jump to content

How should I do this, what would you recommend


benthomasg1

Recommended Posts

Well I am working on this new site for fun I don't have any of the development done for you to even look at but I am here trying to see what others would recommend to solving on issue that I have.

 

Ok, well basically what I want to be able to do is allow for other users of the site to "like" a comment that another member has made, and I want to keep track of how many people clicked the link and do what I can to not let them click the like again.

 

What I can see for two options are to 1) in the comment table keep a number that increments every time someone clicks it, and then in a cookie tell the site the link has been clicked so the user does not see the like anymore, but then if the user removes the cookie they will be able to click the link again.(Not to big of a deal I guess) or 2) set up a different table that keeps track of the comment and the user so I can then use sql to count the amount of times that the commentID is in the table and then the user would not be able to click the some comment again this way. (But this just seems like a lot of database space that could be taken up)

 

Any recommendations would be great!

 

Thanks

 

Hi so you should have your users table with their information like

 

id  username  password 

 

and then another tables for comments like

 

id  user_id    comment    like

 

then once a user comments other users can like it, to do this you need to have like column as interger and in mysql each time somebody like that comment ask mysql to add 1 value to it

 

$update = mysql_query("UPDATE comments SET like= like+1 WHERE id=user_id");

 

I hope it helps ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.