Load from mysql with Ajax?

0 favourites
  • 9 posts
From the Asset Store
Plinko MYSQL Online Full Game Casino Construct 3 Game Html5
  • Hello,

    How can i load from mysql database using the ajax function?

    I have access to everything on an host. Like mysql, php etc.

    And when i got it loaded, how can i set a variable to something from the database?

  • This tutorial might give you some insight:

    Online highscore table ajax php mysql-tutorial

  • I already used that one, but couldn't make something out of it.

  • Well, it seems like that tutorial has got the basics for what you are asking about.

    What is it you'd like to know specifically that you can't get from that tutorial?

    This question is actually probably not a construct2 question, but a php/mysql question. Maybe someone on this forum could help you get further, but the Construct2 part of the question is only how to set data gathered from an ajax call and maybe how to send data using Ajax.

  • I really don't know how i do the following:

    Get from mysql db: money from userID (userID var from c2.)

    Then get that (with Ajax) in c2 and show it in the var 'money' in c2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bump.. please..?

  • Do you know PHP ?

  • For PHP you need apache2 daemon (php module), MySQL daemon (or another database server), or easier WAMP (Windows Apache MySql Php) LAMP (Linux Apache MySql Php) or Xamp, or something else...

    For Java you need application server like tomcat or jboss,... and a database server (you also need the connector)

    The more important is to retrieve data and send it as JSON or XML

    PHP is easier way cause you don t need to know about servlet. Just php script and "attack" this url with/without POST/GET to filter datas you want to retrieve.

  • The more important is to retrieve data and send it as JSON or XML

    That is only important if you use JSON or XML elements.

    And he mentioned he has a web server available etc.

    It will come down to the creation of a php file able to read the required values from his database and relay that back as text strings.

    That, and the Ajax call with the propper parameters to call the file.

    PHP can simply echo out all the needed info and the ajax call will make it available in Ajax.Lastdata.

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