Creating the Database

Create a database highscores and a table scores as the following structure:

CREATE TABLE `scores` (
`scoreid` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`gameid` INT UNSIGNED NOT NULL ,
`name` VARCHAR( 255 ) NOT NULL ,
`score` INT NOT NULL ,
`ip` VARCHAR( 16 ) NOT NULL ,
`time` DATE NOT NULL,
`agent` VARCHAR(255) NOT NULL
);
ALTER TABLE `scores` ADD PRIMARY KEY ( `scoreid` )

The only essential columns here are score and name, however we can store some interesting data about the connecting user in the other columns. Storing the time posted will allow us to show the high scores for all-time, or just today and so on, by modifying the SQL query slightly.

Next...Getting and posting scores

 

 

( categories: )