How do I Get Values from MySQL Database

0 favourites
  • 3 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • Hi guys.

    i want to get a single value to set in a Global Variable in my project from a specific field from my mysql database

    i cant use MySql directly in Construct 2? so i need to use an external PHP file with the query on it?


    • I want to select the last Score saved:

    SELECT * FROM scores ORDER BY points DESC Limit 1

    and i want to save that value into a Global Variable called LastScore...

    how can i do that?

    i dont understood very well how AJAX.LastData works :S


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • yes, you'll need php/perl/anything else to query the MySQL database and then return the data. look up cgi scripts and you'll see lots of exaamples. you can then use ajax to query the script on your server and then parse the data.

    just be aware that you will find it awkward to test as you need to have a server and get around the cross-site scripting issus.

  • ill try this in localhost,i know php+mysql, it is just dont get very well ajax in C2 xD ... -php-mysql

    well, that was easy... lets see later when the game is published to try if it works in the play store with (of course with my own hosting) xD!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)