Creating your own Leaderboard / Highscores easy and free (PHP MySQL)

Index

Attached Files

The following files have been attached to this tutorial:

.capx

highscore-example.capx

Download now 178 KB
.zip
.zip

Stats

17,284 visits, 47,434 views

Tools

PHP to read and write scores

Open the PHP files you downloaded from this tutorial (right click -> Edit with Notepad) and update the database part according to the data of your account - like the two images shown below.

(You can find this data also on Software/Services -> MySQL -> "List of your current databases and users")

Repeat this step with both php files: 'savescores.php' and 'getscores.php'

Next step. Go to your CPanel and access your File Manager. Here you can upload files, images, sounds, games, etc... This is where the PHP files will be saved.

Notice the 'DO NOT UPLOAD HERE'. You should click "public_html" directory and save there your files. To UPLOAD your php files, click the "Upload" button and select 'savescores.php' and also 'getscores.php'

Reading scores (testing our PHP)

Use your domain assigned to your account and type on your internet browser (Google Chrome, Firefox, etc) the following:

http://c2tutorial-duquekarl.hostei.com/getscores.php

If you can see the 'best scores' you previously saved on the database, you have set it up correctly. Congratulations!

The server part is ready. Now you only need to set up Construct 2.

  • 3 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Great tutorial for a refresher. Ive just finished reading through the tutorial and will soon be implementing the PHP.

  • Have there been any updates to this - I copied it verbatim and am familiar with mYSQL and PHP a bit and this did not work for me - in terms of posting and retrieving scores? Also noticed another comment - that it wasnt saving?

  • cant save but the get score is working