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
https://forums.phpfreaks.com/topic/164172-solved-puzzle-plot-database-design/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.