SQLite question...

I have a game with a large number of levels, and the player can achieve a different score in each level, which I need to keep track of.
So my table should look something like:
maxLevel | level1 | level2 | level3 …

I have a variable called numLevels which holds the number of available levels in the game. Since this changes all the time right now, I’d love it if I could use some sort of loop which will create the columns in the table according to the number of available levels.
Can anyone please help me with this?

Thanks! [import]uid: 44037 topic_id: 28135 reply_id: 328135[/import]

That’s not how this is usually done. Instead, you should have only 1 column that stores the unique name/ID of the level and a column for the high score. Something like this…

Table: high_scores
Columns: player_id, level_id, high_score

Each row will then contain only the high score of only one level… and whatever other information that you want to attach to it such as fastest time, treasures found, etc. This also makes it a hell of a lot easier to add more levels to your game because they will just be new rows in that table.

Anyways, that’s my 2 cents. [import]uid: 32256 topic_id: 28135 reply_id: 113687[/import]