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

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

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