Skip to main content
Known Participant
December 7, 2006
Question

letting members rate comments

  • December 7, 2006
  • 3 replies
  • 301 views
i have a message area on my website and was wondering how you would go about letting members rate other members comments...I presume its a matter of having a form with a check box with hot or not....and that form passes to an action page, which adds +1 to the hot or not column in the message table depending on what has been checked in the check box. The action page would obviously prevent people from rating themselves, and also prevent others from rating a comment multiple times.
Anyway, was just wondering if anyone knew of the code which would add +1 to a number in a column....cheers
This topic has been closed for replies.

3 replies

namtaxAuthor
Known Participant
December 9, 2006
thanks both for your responses...cheers
Inspiring
December 7, 2006
If you want to make sure people don't vote multiple times, you'll generally need to do a second table, that keeps track of the votes by IP address (or other identifier if you have one). You can include the column there which would have the user's vote (0 or 1 or a range of votes) and then can run sums and averages on it by message ID.
December 7, 2006
UPDATE table SET column = column + 1 WHERE id = xxx

you'd probably also want a # of votes column so you can calculate an average.