IronChefMorimoto
Limp Gawd
- Joined
- Apr 14, 2002
- Messages
- 273
I'm finishing up a Flash quiz that's powered by PHP/MySQL, and I'm trying to figure out the best method for storing the high scores in the database. Here's an overview of what I had in mind:
Is there a better way to do this?
Keep in mind that I am not storing unique usernames as part of a registration or login system. This is strictly anonymous high scores. I'm storing ALL the scores in case I need to do a running tally of all scores. However, that's going to be slower than keeping a separate small batch of high scores in it's own table, right?
Finally, is it better to have the quiz_HighScores table structure the same as the quiz_Scores structure? Or should I use foreign keys tied to the quiz_Scores table?
If this is a bad approach, I'd like to know. Any suggestions are very appreciated.
IronChefMorimoto
- User finishes quiz and has a total points score stored
- User fills in 3-letter initials (arcade style) and submits their score
- Score goes into quizScores table (id, points_regular, points_bonus, points_total, initials, user_ip, user_browser, user_timestamp)
- After updating quizScores, check user score against the lowest score in quiz_HighScores
- Delete the lowest score in quiz_HighScores table and insert the user's high score IF the user's score is higher, then return the top 10 or top 20 high scores to the Flash interface
- If user's score is NOT higher, run SELECT on the anonymous quiz scores table and at least return the user's score rank from that table
Is there a better way to do this?
Keep in mind that I am not storing unique usernames as part of a registration or login system. This is strictly anonymous high scores. I'm storing ALL the scores in case I need to do a running tally of all scores. However, that's going to be slower than keeping a separate small batch of high scores in it's own table, right?
Finally, is it better to have the quiz_HighScores table structure the same as the quiz_Scores structure? Or should I use foreign keys tied to the quiz_Scores table?
If this is a bad approach, I'd like to know. Any suggestions are very appreciated.
IronChefMorimoto