MySql

Monkey Targets Forums/HTML5/MySql

Yoda(Posted 2011) [#1]
Is it possible access a MySql Database from within the Monkey programming running as HTML5, i.e. to save highscores on the server etc.

Any example code for this?
(reading or writing a number to a mysql database)

Please help!


GC-Martijn(Posted 2011) [#2]
I think its not possible at the moment.

Maybe its possible to save using SaveString() to a .txt file.
Then a php script use that .txt file to put all the data inside mysql.


c.k.(Posted 2011) [#3]
There is a library called mnet (I think) that should let you call a PHP script on your site to manage a high score database.

For instance, from within the HTML5 program, you would only need to do something like this:

send( "http://www.mysite.com/score_keeper.php?user=billy&score=1200" )

Of course, you'd want to obfuscate that so people can't cheat. Something like:

send( "http://www.mysite.com/score_keeper.php?jsjdjdjd9289fja09s8d8jf9" )

Now, on your site, the score_keeper.php program will be the one that accesses the MySQL database.

You could also have a get_scores.php script which would return a list of high scores (or other data) to your program. score_keeper.php could be made to do it all, as well.

Edit: I was right! :)
mnet can be found at http://www.monkeycoder.co.nz/Community/modules.php