I am creating a little online quiz/game. I have a
users-table containing a unique auto-increment
username campo, un
password campo y una
ip field (from where it was created).
That handles the log in and stuff like that.
Then I need to track the users process. The user has to complete several tasks, or levels. However you wish to view it.
The requirements are the following, for each task:
- Keep track of how many attempts the user has done for a given task
- Keep track of his last attempt
- Keep track of where he failed
- Keep track of his shortest successful attempt
- Keep track of his most recent successful attempt.
What I am asking is basically how I should structure my tables for this to work as smooth as possible and require as little annoying SQL-queries and code as possible.
Should I have one table for each task with each row bound to a username and fields corresponding the list above? Or one large table with a row bound to the username that indicated which task and all the fields corresponding the list above?
I am not sure, which is why I am asking.
Worth mentioning: Anything I currently have is not set in stone, so I can change anything you want.
Any help and/or suggestions are much appreciated.
Gracias de antemano.
EDIT: I will also have one table with each task: tasks(id, name, description, finish_message)
And with that I need to have a new table structure for the tasks similar to the one I described above for the users and tasks, but for the tasks and tests.
preguntado el 25 de agosto de 12 a las 10:08
I didn't get your question completely, but I think following structure might help you:
1. users(userid, username, password, ipaddress) 2. tasks(taskid, task_description,...)--any other details you want 3. task_attempted(userid, taskid, last_successful_attempt, shortest_successful_attempt, last_attempt, last_failed_testid); 4. tests(testid, taskid, ...)--other details
Please clarify your third requirement:
Keep track of where he failed
If I am not getting you wrong user might not be able to proceed to give next test of a task until she finishes current test successfully, so you can add one more field for test_id for keeping track of failed test_id in particular task.