How do I connect to a mysql database

Get help using Construct 2

Post » Fri Oct 16, 2015 8:32 am

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
B
4
Posts: 5
Reputation: 210

Post » Fri Oct 16, 2015 8:39 am

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.
B
10
S
2
Posts: 12
Reputation: 632

Post » Fri Oct 16, 2015 9:06 am

hi rushty
thx a lot for the fast answer.

can u show me with a *.capx file or screenshots an example please :D
B
4
Posts: 5
Reputation: 210

Post » Sat Oct 17, 2015 12:07 am

ok i have no idea how i realize that :( have any one a idea
B
4
Posts: 5
Reputation: 210


Return to How do I....?

Who is online

Users browsing this forum: eochranek, fearfulelephants and 19 guests