Jump to content

Tracking Scores with PHP


ucichem

Recommended Posts

Hello all.  I am creating an interactive online tutoring service for the University of Connecticut.

I am trying to find a way to keep track of points using PHP.  Each time a user accesses a 'hint', one point needs to be deducted from their score.  Users might access just one hint, or several.  I want to be able to notify the user of their score changes based on how many hints they access.  Can this be accomplished with PHP?

I am currently using a Mac OS X, version 10.2.8.  I have an Apache webserver with PHP enabled, but I do not have MySql.  I also don't have globals enabled.

Thanks,
e-Tutor webmaster
Link to comment
Share on other sites

I am just creating a demo version of the site.  The scores are used mainly for user feedback, not for grading, so it is not necessary for me to compile the individual scores.  As far as the users accessing the hints, I have not decided on a method yet.  I could use forms or just simple links, depending on what will work best with tracking using PHP.
Link to comment
Share on other sites

I think that the words I used to describe my issue is misleading.  Let me try again.

I want the user to be able to see his/her deduction of points based on where they click.  This information does not need to be stored in a database or ever accessed again.  The points are purely for the user's knowledge of how they are doing on a particular question, based on how many hints they click.  For example, the user starts with 5 points.  If they click on a hint, that's a one point deduction, so now the site tells them they have 4 points to work with.  If they click on another hint, they lose another point, so it will be displayed that they have 3 points.

Do I need MySql to do that?  I am a PHP novice and do not have any experience with MySql, nor do I have it set up and running on this system.  I would only take the time to install it if it was absolutely necessary.

Thanks for all the help already.
Link to comment
Share on other sites

Hmm.. Just for your informations, to me... PHP can't live without combination of MySQL.
Now I understand what you trying to do, I would suggest you to start learning MySQL and do the sql table structure.

Since you know more about your script, so it's easier to set up a table structure yourself.
What I mean is, I don't know how your point deduction system is calculated, is it only 1 person has 5 hints total ? Or every question have their 5 points each..
Link to comment
Share on other sites

This is one of those questions where asking in a clear way is more difficult than the actual coding I guess, hahaha.  Thanks for bearing with me everyone.

Each question has a total of 5 points available.  There are also 5 hints to be available for each question.  Each hint viewing would deduct one point from the total.  For example, if the user clicks one hint, they lost one point, and have a total of 4 left.  If they use their one hint and answer the question correctly, they have earned 4 points.  If they view 5 hints, they lose all their points.  I have already figured out how to score incorrect or correct answers.  I am just having trouble with figuring out how to display scores based on the pages that a user accesses.  I have forms configured where the user is asked whether they want to view a particular hint.  I am pretty sure that there is a way to tabulate how many submissions of 'yes' a user sends, and therefore be able to calculate the score deductions based on views.

I do not need to store the scores at all.  The scores just need to be calculated and displayed for the user.

Another thought... Could I create one main page with 5 questions, all using html/php forms?  Each question would ask whether the user wanted to view a particular hint.  With the right code, couldn't I total how many yes answers I got, and deduct from 5 based on that?

Again, thanks for all the help. 
Link to comment
Share on other sites

Oh.. So its sort of a poll, which they can do it over and over again ?
Hmmm... If that so, then you can uss session and cookie to stored the hints/points.

As for your 2nd question, everything is possible it just take times to think how to script it out.
Sorry, the best I would help out now is telling you to use cookie and session for the points.
I'm going off soon to start studying.

Example:
setcookie("q1", "1", time()+3600);
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.