close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Scoring system

Thread began 11/07/2013 1:04 pm by iainmacdonald331081 | Last modified 11/07/2013 3:52 pm by iainmacdonald331081 | 936 views | 2 replies |

iainmacdonald331081

Scoring system

This will likely be custom support needing a paid ticket (which isn't a problem), but its got to start somewhere.

I'm looking to add a scoring system to an existing database.

There is currently a table 'lodges', and the objective is to have a series of questions where voters can give a score out of 10 for a lodge for each question.

So an example question might be:

index5.php

This inserts a record in a table 'scores' with the field:

LodgeID (to link back to the lodges table) - hidden field pulling through the LodgeID from the query on the page.
Question which is currently just a number (maybe worth having a third table 'questions' - also a hidden field.
Score ID - unique PK for the 'scores' table.
Score - the score based on the selection made.

So for example, that gives a table with records like:

ScoreID, LodgeID, Question, Score
1, 288, 1, 10
1, 288, 1, 8
1, 288, 1, 6
1, 288, 1, 4
1, 288, 1, 2

So far so good - the part I would need help with is to calculate and store:

1. The number of votes cast for any question for any lodge.
2. The average score received for that question.

So with the sample data above LodgeID 288 has had 5 votes cast for question 1, with an average score of 6.

I hope that makes sense - it may be that the table fields / structure is all wrong, or at least needs additional fields somewhere to store the calculated fields, but I wanted to at least try to make a start so it might make some sense.

If you could steer me in the right direction, or even help out with some paid support that would be appreciated as ever.

Sign in to reply to this post

Jason ByrnesWebAssist

Use SQL to calculate the average and count the answers:

SELECT COUNT(ScoreID) as scoreCount, AVG(Score) as AverageScore FROM scores WHERE LodgeID = 288 AND Question = 1

Sign in to reply to this post

iainmacdonald331081

Thanks Jason - that's a big help getting the next bit done.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...