ucichem Posted July 31, 2006 Share Posted July 31, 2006 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 Quote Link to comment Share on other sites More sharing options...
king arthur Posted July 31, 2006 Share Posted July 31, 2006 How are you storing the users and their scores, and how do they access the hints? Quote Link to comment Share on other sites More sharing options...
ucichem Posted July 31, 2006 Author Share Posted July 31, 2006 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. Quote Link to comment Share on other sites More sharing options...
ItsWesYo Posted July 31, 2006 Share Posted July 31, 2006 Well. I'm no PHP expert or anything ... but wouldn't you need to have mysql to keep track of user points? Quote Link to comment Share on other sites More sharing options...
hackerkts Posted August 1, 2006 Share Posted August 1, 2006 You can store them in MySQL database or in txt file, normally I would use mysql since it's easier. Quote Link to comment Share on other sites More sharing options...
ucichem Posted August 1, 2006 Author Share Posted August 1, 2006 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. Quote Link to comment Share on other sites More sharing options...
hackerkts Posted August 2, 2006 Share Posted August 2, 2006 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.. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 2, 2006 Share Posted August 2, 2006 you dont have to make a database u can do it by a .txt file so installing mysql isnt absolutely necessary Quote Link to comment Share on other sites More sharing options...
hackerkts Posted August 2, 2006 Share Posted August 2, 2006 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/ Quote Link to comment Share on other sites More sharing options...
mastermike707 Posted August 2, 2006 Share Posted August 2, 2006 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) Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 2, 2006 Share Posted August 2, 2006 wouldn't sessions like kill your bandwidth? Quote Link to comment Share on other sites More sharing options...
mastermike707 Posted August 2, 2006 Share Posted August 2, 2006 [quote author=BillyBoB link=topic=102454.msg407919#msg407919 date=1154507062]wouldn't sessions like kill your bandwidth?[/quote]Can you explain that please? Doesn't the user still load the same amount of pages? Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 2, 2006 Share Posted August 2, 2006 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:) Quote Link to comment Share on other sites More sharing options...
mastermike707 Posted August 2, 2006 Share Posted August 2, 2006 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. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 2, 2006 Share Posted August 2, 2006 but if he just used a txt and there would be no load :) Quote Link to comment Share on other sites More sharing options...
ucichem Posted August 2, 2006 Author Share Posted August 2, 2006 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. Quote Link to comment Share on other sites More sharing options...
hackerkts Posted August 3, 2006 Share Posted August 3, 2006 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.