Jump to content

[SOLVED] Puzzle plot database design


lore_lanu

Recommended Posts

Hi all,

 

I am in the process of building a sort of 'plot' where users can register and compete to complete puzzles. The puzzles are in order, so a user can't go on to puzzle 1 without solving puzzle 2 and so on...

 

I was wondering what would be the best way to store a users' progress in my mysql database. I was thinking that when a user correctly answers a puzzle, a row labeled 'puzzle' would update to that puzzle number. If a user tried to access a puzzle with a higher number than the one stored in the database, they would be rejected.

 

I'm not sure if that made much sense, but is there a more efficient way to store this information?

 

Thanks in advance!

Link to comment
Share on other sites

Yes, that's the correct way of doing it on a small scale. If you had 1 million users and constantly updated their progress every let's say 80 seconds - that would be a problem. On a large scale you would simply add a row with the user_id and the puzzle_id they accomplished. A cron job would cycle through those records and update the original user rows of their progress. To make this "cron" job work - you'd also need to make sure that you store the user's progress in a PHP Session to keep things as correct as possible.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.