# High scores w/ MySQL - is this good/bad approach?

**URL:** <https://forum.kirupa.com/t/high-scores-w-mysql-is-this-good-bad-approach/233734>\
**Category:** programming\
**Created:** [July 26, 2007, 2:23pm UTC](https://forum.kirupa.com/t/high-scores-w-mysql-is-this-good-bad-approach/233734 "2007-07-26T14:23:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ironchefmoto](https://avatars.discourse-cdn.com/v4/letter/i/91b2a8/32.png) [@ironchefmoto](https://forum.kirupa.com/u/ironchefmoto)\
**Post date:** [July 26, 2007, 2:23pm UTC](https://forum.kirupa.com/t/high-scores-w-mysql-is-this-good-bad-approach/233734/1 "2007-07-26T14:23:06Z")

</div>

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:  
[LIST]  
[_]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  
[_]Return the top 10 or top 20 high scores to the Flash interface[/LIST] **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?**

If this is a bad approach, I’d like to know. Any suggestions are very appreciated.

IronChefMorimoto
