Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 5th, 2006, 05:53 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default 'Feedback' Scoring system

Hi

I am trying to create a feedback section of a website and trying to get the feedback scoring system working like this:

If a user receives a positive feedback then the users score increases by 1.
If the user receives a neutral feedback then it has no effect on the users score.
If a user gets a negative feedback then the users score is subtracted by 1.

All easy so far, but how do I only allow separate users to have an impact of only 1 on the users score, ie if the customer has 2 positive feedbacks then the customers score will only rise by 1.

It is basically the system Ebay uses I am trying to replicate and a description is here of the system http://pages.ebay.co.uk/help/feedbac...ck-scores.html

But how am I going to create the query to only ever effect a users score by 1? Here is what I have so far, but it will only get the sum of the users score but not take into account the 'distinct' element I need from the 'from_username' column:

SELECT sum(feedback_score)
FROM feedback
WHERE feedback.to_username=thisuser

I have tried this:

SELECT DISTINCT(from_username)
FROM feedback
WHERE feedback.to_username=thisuser

that gets the distinct usernames from the table, but how do I combine the 2 queries to get the desired result?

Sorry for the length of the post

TIA
David
Reply With Quote
  #2 (permalink)  
Old October 24th, 2006, 05:33 PM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Add LIMIT 1 to the end?

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Student feedback system..help dhanuka ASP.NET 2.0 Basics 1 July 28th, 2007 05:11 AM
Concern and feedback picnn Intro Programming 1 October 30th, 2006 02:36 PM
feedback into email alitoday Classic ASP Databases 3 August 2nd, 2004 06:07 AM
ASP Feedback Ben Horne Classic ASP Basics 2 November 21st, 2003 11:30 AM
Feedback- not support. Hal Levy Wrox Book Feedback 0 July 4th, 2003 10:36 AM



All times are GMT -4. The time now is 09:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.