lore_lanu Posted June 30, 2009 Share Posted June 30, 2009 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 More sharing options...
TheFilmGod Posted June 30, 2009 Share Posted June 30, 2009 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 https://forums.phpfreaks.com/topic/164172-solved-puzzle-plot-database-design/#findComment-866040 Share on other sites More sharing options...
lore_lanu Posted July 4, 2009 Author Share Posted July 4, 2009 Thanks for your input! I'll work on implementing this straight away. Link to comment https://forums.phpfreaks.com/topic/164172-solved-puzzle-plot-database-design/#findComment-868666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.