How do I connect to a mysql database

  • Hi all,

    I’d like to create a multiplayer quiz and I have a little issue since two days. I tried to search for a solution on google and in the forums, but didn’t get any additional information.

    My game should get the questions directly from a mysql database. How can I set up a connection, so that the game gets random questions from the DB?

    Second question is: how can I define, which questions (out of four possible) is the correct one?

    Cheers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To get the questions use the Ajax plugin to retrieve the questions from a PHP script which itself will query the mysql db using something like

    SELECT question FROM questions ORDER BY RAND() LIMIT 1

    which should get 1 random question, though your probably getting a lote more in one hit and returning a json array to populate an array or something.

  • hi rushty

    thx a lot for the fast answer.

    can u show me with a *.capx file or screenshots an example please

  • ok i have no idea how i realize that have any one a idea

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