• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

letting members rate comments

New Here ,
Dec 06, 2006 Dec 06, 2006

Copy link to clipboard

Copied

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
TOPICS
Advanced techniques

Views

239

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 06, 2006 Dec 06, 2006

Copy link to clipboard

Copied

UPDATE table SET column = column + 1 WHERE id = xxx

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 06, 2006 Dec 06, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 09, 2006 Dec 09, 2006

Copy link to clipboard

Copied

LATEST
thanks both for your responses...cheers

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation