I was wondering how to efficiently record and display the progress of users in an online quiz with mysql and php. If users want to skip certain questions or close the screen, I want them to come back and see the the progress made by having a “completed” next to the question list item or something.
The problem or concern really is how to go about storing that progress and how to check for it.
Here’s my database design simplified for this question’s sake
table 1: user
fields: id, username, pw, username, progress
( yes I have the field called progress here)
table 2: questions
fields: id, lesson, question, hint, answer
so if a user completes a question, then in the progress field, I’d append the question_id in there.
On the homepage with the question list, I would have a grab the progress field of the user id after it’s passed into the page so…
select progress from user where id = $user_id
I’d probably get all these array with all the id’s of the completed questions
Then I’d have to do an if statement for each question “if question id = progress [id] then echo “completed” ” kind of thing statement.
Does this seem efficient? Or how else would you do it? I’d appreciate any tutorials online that does this kind of thing so I can get a much better idea of what’s going on . Thank you
I would store answered questions in their own table.
Now you can efficiently get all completed questions
Or not yet completed questions