bearzilla Posted December 22, 2006 Share Posted December 22, 2006 I have table with 11 columns, one of which is an auto-increment id that I use to track a session. The other 10 are quest_one, quest_two, etc... These will have the value of "Correct" or "Incorrect." What would the query be on the last page that adds and outputs, "You answered 6 out of 10 correctly"? Quote Link to comment Share on other sites More sharing options...
mem0ri Posted December 22, 2006 Share Posted December 22, 2006 Why not just create a session variable that counts up as each question is answered correctly? Or are you trying to run all your "sessions" through a database table for a particular reason?Something as simple as:[code=php:0]if($quest1 == "correct") $_SESSION['correct'] += 1;[/code]On each page...followed by[code=php:0]echo("You answered ".$_SESSION['correct']." of 10 questions correctly.";[/code]on the last page would make the most sense to me... 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.