Stats

10.4K visitors
85.2K page views
4.6K translation visitors
21.9K translation page views

Online High Score Table (AJAX, PHP, MySQL)

Favourite 233 favourites
Tutorial written by ArcadEdOriginally published on 13th, July 2012 - 10 revisions

Welcome to my video tutorial explaining how to setup a mysql database on your hosting account, then setting up Construct 2 using that database for a high score table.

This video series assumes you have an online hosting account, or access to creating mySQL databases. I recommend www.HostGator.com if you do need a web host.

Files

PHPs and TXT files - updated July 19th,2012
CAPX File - I updated this file using one Text object that is copy and pasted 20 times. Then updated the code using For Each loops. Much faster. I will put in a video explaining the changes.

Videos

Part 1: Creating the Database
Part 2: Creating the DB Table
Part 3: The PHP Files
Part 4: Construct Part 1
Part 5: Construct Part 2
Part 6: Construct Part 3
Part 7: Construct Part 4
Part 8: Construct Part 5
Part 9: Construct Part 6

Notes:
It's likely the php files do not need to be in your cgi-bin folder to work. I just know it's a folder that all hosted domains typically have. You can try putting the php files in the root of the domain, or a different directory, they should work fine.

The server running your PHP files must have PHP installed on it. It's installed by default with most hosting accounts. This won't work by putting the files in a dropbox folder. It has to be on an actual hosted server with PHP installed. If you are getting errors or the file is trying to download, contact your hosting company support and they can tell you the issue right away.

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Comments

4
ArcadEd 22.0k rep

Whao, formatting is weird. Sorry, I will try to get that cleaned up in a while.

Friday, July 13, 2012 at 7:40:59 PM
4
ArcadEd 22.0k rep

Much better now.

Friday, July 13, 2012 at 9:32:53 PM
10
Wink 10.8k rep

Wow! Just brilliant! You sure do have some great communication skills ArcadeEd.

I was hoping someone like you would come around some day, and make a great detailed tutorial like this on how to use Construct 2 with AJAX, PHP, and MySQL. I believe your tutorial will help a lot of people that have been struggling with this.

Would you consider making more tutorials on this subject in the future? For example systems that could be implemented into our games to create real-time social games like a registration/authentication system, a building class of some kind, a trophy or award system, and maybe even a virtual economy or money system?

If so here is a link to some scripts, and SQL's to take a look at:

https://github.com/andrespagella/Making-Isometric-Real-time-Games

Anyway, I just wanted to say thank you for making this great tutorial :D

Friday, July 13, 2012 at 9:34:22 PM
9
ArcadEd 22.0k rep

Wow, thanks for the compliment :). I would happy to make more tutorials if it helps people out.

Friday, July 13, 2012 at 9:38:45 PM
3
Wink 10.8k rep

Your welcome. That would be great if you could :D

There are so many Construct 2 users like myself that want to make real-time social games like FarmVille or even a simple city builder for example but are just lost.

It would be greatly appreciated if you could help us all :D

Friday, July 13, 2012 at 9:50:13 PM
3
ArcadEd 22.0k rep

Well you are welcome to hit me up on facebook or skype (ArcadEd on both) for anything specific. I can try to help.

Friday, July 13, 2012 at 9:53:36 PM
1
Wink 10.8k rep

Ok, thanks a lot :) And thanks again for this great tutorial :D

Friday, July 13, 2012 at 10:02:57 PM
1
Animate 11.9k rep

Awesome work on the tutorials, the C2 community had been waiting on something like this. Please help in creating more like these, would be awesome to learn how to post and save in-game achievements to non-programmers. ...Thank you for the amazing work!

Friday, July 13, 2012 at 10:42:56 PM
1
ArcadEd 22.0k rep

Achievements is a pretty cool idea. You are thinking like Xbox Live has? That could be really fun :).

Friday, July 13, 2012 at 10:46:31 PM
1
EyeHawk 7,762 rep

Wow Ed, this is amazing. I seriously was thinking the other day "how do I get highscores integrated with C2?", and like magic here it is! :) Thanks a million - well done and looking forward to more of your tutorials.

Sunday, July 15, 2012 at 3:27:47 AM
1
Julmust 4,885 rep

This is very helpful, thanks for a very informative tutorial. I would love to see more from you in the future :) I would even pay for this in the new Scirra Store.

Sunday, July 15, 2012 at 4:09:54 AM
1
ArcadEd 22.0k rep

Thank you all. The store is an interesting idea, maybe I will email scirra about it.

Sunday, July 15, 2012 at 6:19:44 AM
1
vidi 5,058 rep

Thank you! much appreciated :)

Sunday, July 15, 2012 at 10:55:07 AM
1
AJTilley 5,086 rep

Hi great tutorial. I have only looked through a few of them so far, but this is just what I needed to make some of my games just a little bit better.

I hope you are able to do some more tutorials for some of the suggestions made earlier. If there was a way of creating some kind of virtual currency to make an actual micro transactional shop work etc would be great.

anyway great job so far.

Monday, July 16, 2012 at 1:03:50 PM
2
ArcadEd 22.0k rep

I updated the php files to include the
Access-Control-Allow-Origin: *

This allows the scripts to work on other domains.

Tuesday, July 17, 2012 at 7:31:31 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.