Load from mysql with Ajax?

Get help using Construct 2

Post » Mon Feb 03, 2014 6:32 pm

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?
Image

Coin Clicker 2 [Play store]
B
15
S
2
Posts: 81
Reputation: 917

Post » Mon Feb 03, 2014 6:36 pm

This tutorial might give you some insight:

Online highscore table ajax php mysql-tutorialLittleStain2014-02-03 18:36:16
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Feb 03, 2014 9:02 pm

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

Coin Clicker 2 [Play store]
B
15
S
2
Posts: 81
Reputation: 917

Post » Mon Feb 03, 2014 9:15 pm

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Feb 03, 2014 10:02 pm

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.
Image

Coin Clicker 2 [Play store]
B
15
S
2
Posts: 81
Reputation: 917

Post » Wed Feb 05, 2014 3:36 pm

bump.. please..?
Image

Coin Clicker 2 [Play store]
B
15
S
2
Posts: 81
Reputation: 917

Post » Wed Feb 05, 2014 3:38 pm

Do you know PHP ?
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Wed Feb 05, 2014 4:06 pm

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.
B
8
S
2
Posts: 35
Reputation: 838

Post » Wed Feb 05, 2014 4:21 pm

[[email protected]]
The more important is to retrieve data and send it as JSON or XML

[/QUOTE]


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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572


Return to How do I....?

Who is online

Users browsing this forum: BackendFreak, blackhornet, jezjones24, Yahoo [Bot] and 7 guests