Save Game's current state in database using system SAVE feature

2

Stats

3,099 visits, 4,595 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 14 Jul, 2014. Last updated 19 Feb, 2019

I was thinking how to save current state in database, till now I was aware of string thru Ajax, so I was using "savejobs=" & URLEncode(savejobs).

This method is good if you want to save some data like score, killed, earned etc...

Well save current state is bit tricky, you just need to call correct method at correct place as given in manual.

In my case I have saved file locally using "save" and then called Ajax in "On Save Complete" method, so here is the catch.

Call Ajax and set your "Data" to something like this

"savejobs=" & URLEncode(SaveStateJSON)

Below is the php code to insert into database table.

PHP Code :

<?php

header("Access-Control-Allow-Origin: *");

include "handledb.php";

$SQL="insert into test (data) values ('".mysql_escape_string($_POST["savejobs"])."')";

$result = mysql_query($SQL);

?>

Hope you like to tutorial... cheers..

  • 0 Comments

Want to leave a comment? Login or Register an account!