Creating your own Leaderboard / Highscores Easy and Free (PHP & MySQL) [UPDATED 2020]

25
  • 69 favourites

Index

Attached Files

The following files have been attached to this tutorial:

.zip
.capx

highscore-example.capx

Download now 180.37 KB

Stats

31,291 visits, 85,269 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

In this tutorial you will learn how to create your own Highscores for your games, using your own free server / database. Let's go!

Here's an example of how the leaderboard with high scores can look on your game. Image: Santa Hop!

What do you need?

- Your Construct 2 game (or C3)

- A server with PHP and MySQL databases (you can get a free server on 000webhost.com)

- Download the PHP7 files (phps.zip is for older versions of php5)

Let's start, step by step...

Registrating Your New Free Server

A server is like a computer on internet where you can save your own data: pictures, files, databases, scores, games and many more things...

000webhost.com offers free web hosting, with PHP and MySQL. It allows you to create 1 free website, host your files and you can create 2 free Databases.

Go to http://www.000webhost.com. Click "Sign Up" and register as a new user.

Fill your name, email and select a new password. When you are done you will receive a confirmation email, open your email account and Confirm your registration.

Back to 000webhost, select Create a New Site. Then type a name for your free domain, ie: duquekarlgames.000webhostapp.com

The next step is to access your dashboard.

Access your Dashboard

If you have already signed up and confirmed your free account, then you can log in to your account. To access your Dashboard, click Manage Your Website.

  • 99 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • [FIXED] The scripts save/get should be updated according to the latest PHP formatting rules. After fiddling after a bit I found that in the save.php you should remove the "id" parts when inserting the score.

  • Great tutorial for a refresher. Ive just finished reading through the tutorial and will soon be implementing the PHP.

  • Thanks for this super clear tutorial! I like your idea about separating the scores by 'level' or by 'difficulty' (easy, medium, hard). Do you have a tutorial for this? Thanks alot!!!!

    • First, your scores table must have a new column. So you have: name, score AND level/difficulty.

      Then, when submitting score to savescores.php, you already sent name & score. Now you must also add the new variable: level/difficulty.

      Last, when getting scores with getscores.php, let's say you will read only scores for level 2 or difficulty easy.

      You can send a variable level/difficulty from the game to getscores.php. Edit the getscores.php PHP file to read from the Database only the scores with the requested level/difficulty.

  • hello, I have successfully created Hiscore with this tutorial. But I have a problem when I want to update the database or delete it.

    Can you please help how to update and delete the database?

  • Hi! Thanks a lot for this tutorial and for giving us the example projects and folders! This is really what users want!

    Could you please explain how could I improve/edit the design of the leaderboard tables? What would be the method? I there a way I can create the design on a software like Dreamweaver and have this php/mysql leaderboard implemented? Ou maybe even edit the design as a page/post on Wordpress?

    Lastly, would you be wiling to help me doing this for a work project of mine? Off course I'll be glad to pay something.

    All the best,

  • Load more comments (92 replies)