High Score Table

Flash Code - Insering a Highscore

Paste the following function inside your Flash document:

( categories: )

Flash Code - Fetching Highscores

Now we have our two php scripts to manipulate the database, all we need to do is call these pages from our Flash code (or whatever language your game maybe coded in). Include the following code near the start of your Flash document:

( categories: )

Getting and Posting Scores

Now we need to provide the interfaces for our program to the database. This will be by means of two php scripts; one for posting a score, the other for fetching the high score table. These will be called, with the correct parameters, from our Flash program (or indeed any program that has internet access).

 

Fetching the Highscore Table

The first script we need is getscores.php. The only parameter is gameid, which we will set to '1' for now. This is so that we can use the database to store high scores for different games.

( categories: )

Creating the Database

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

( categories: )

Creating a High Score Table

Introduction

Everyone wants prove they are "the best of the best", and what better way to prove it than getting your name into the halls of fame. A high score table will allow others to pit their wits against each other, while also giving an incentive to play again.

For this tutorial, you will need:

  • Access to a mysql database
  • Able to run php code on your server

Although the code examples will be using php / mysql / flash, the techniques will work using (for example) SQL Server / ASP / C++.

 

( categories: )