Jump to content


Photo

Tracking Scores with PHP


  • Please log in to reply
16 replies to this topic

#1 ucichem

ucichem
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 31 July 2006 - 04:27 PM

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

#2 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 31 July 2006 - 04:40 PM

How are you storing the users and their scores, and how do they access the hints?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#3 ucichem

ucichem
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 31 July 2006 - 05:50 PM

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.

#4 ItsWesYo

ItsWesYo
  • Members
  • PipPipPip
  • Advanced Member
  • 110 posts

Posted 31 July 2006 - 06:39 PM

Well. I'm no PHP expert or anything ... but wouldn't you need to have mysql to keep track of user points?

#5 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 01 August 2006 - 06:27 AM

You can store them in MySQL database or in txt file, normally I would use mysql since it's easier.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#6 ucichem

ucichem
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 01 August 2006 - 04:23 PM

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.


#7 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 02 August 2006 - 07:48 AM

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..

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#8 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 02 August 2006 - 08:03 AM

you dont have to make a database u can do it by a .txt file

so installing mysql isnt absolutely necessary

#9 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 02 August 2006 - 08:12 AM

My opinion:
I don't think storing it to .txt file secure and it's really troublesome.
MySQL is sweet and neat, if you want to try, you can try to install wamp5 its a full package.
http://www.wampserver.com/en/

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#10 mastermike707

mastermike707
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 02 August 2006 - 08:23 AM

Can't you just use a session?
I am getting that the author does not want to store these scores, just display them.

EDIT: Used to talking on an IM (used "u" instead of "you" lol)
[url=http://www.mastermike707.com/new/][/url]

#11 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 02 August 2006 - 08:24 AM

wouldn't sessions like kill your bandwidth?

#12 mastermike707

mastermike707
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 02 August 2006 - 08:26 AM

wouldn't sessions like kill your bandwidth?

Can you explain that please? Doesn't the user still load the same amount of pages?
[url=http://www.mastermike707.com/new/][/url]

#13 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 02 August 2006 - 08:57 AM

um session load on the sever side so that would be like accessing a page wouldn't it if im wrong just call me stupid and we will be even:)

#14 mastermike707

mastermike707
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 02 August 2006 - 09:00 AM

I honestly don't know, I had just never thought about it like that. I guess it would be a little more load, but I think that would outweigh the load of (running, not necesssarily the query) MySQL tho? If I am wrong then just pretend I wasn't in this conversation.
[url=http://www.mastermike707.com/new/][/url]

#15 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 02 August 2006 - 09:04 AM

but if he just used a txt and there would be no load :)

#16 ucichem

ucichem
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 02 August 2006 - 05:25 PM

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. 

#17 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 03 August 2006 - 06:41 AM

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);

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users