I want to using json to send the form to my server
here is my C# code
public string db_url="http://localhost/";
IEnumerator SaveAllPlayerPrefs(object[] parms)
{
string ourPostData = "{\"bone\":\"42\"}";
Hashtable headers = new Hashtable();
headers.Add("Content-Type", "application/json");
headers.Add("Cookie", "Our session cookie");
byte[] pData = System.Text.Encoding.UTF8.GetBytes(ourPostData);
WWW webRequest = new WWW(db_url + "SaveAllPlayerPref.php", pData, headers);
yield return webRequest;
}
and here is my php code:
<?php
$sql_connect = mysql_connect("localhost", "root", "") or die ("no DB Connection");
mysql_select_db("example") or die ("DB not found");
$bone = $_POST['bone'];
mysql_query("INSERT INTO save_game (bone) VALUES ('$bone');");
mysql_close($sql_connect);
?>
When i run it this code its running, but when i check the database, its not save the value of bone. It’s save the empty string to bone, i want it to save 42…
in my database bone is varchar(100) and utf8_general_ci.
Can someone explain to me?
thx before:)