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"? Link to comment https://forums.phpfreaks.com/topic/31620-addition-and-sessions/ 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... Link to comment https://forums.phpfreaks.com/topic/31620-addition-and-sessions/#findComment-146550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.