benthomasg1 Posted December 1, 2010 Share Posted December 1, 2010 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 Quote Link to comment Share on other sites More sharing options...
princeofpersia Posted December 1, 2010 Share Posted December 1, 2010 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 Quote Link to comment Share on other sites More sharing options...
benthomasg1 Posted December 1, 2010 Author Share Posted December 1, 2010 Yeah that is more or less what I was describing as option 1 from my post, thanks for your input. I could not decide from on way or another. Quote Link to comment 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.