I have an Object from Javascript pass to PHP (via AJAX):
var jsObject = {
"name": "Michael Divo",
"age": 27,
"country": "United States"
};
jsObject_json = JSON.stringify( jsObject );
$.ajax({
type: "POST",
dataType: 'json',
url: "http://www.example.com/myserver.php",
data: { mydata: jsObject_json },
}) ...
In, myserver.php:
$json = json_decode($_POST["mydata"], true);
Then if i save that $json
into the MySQL from this PHP end, it is saved as:
Array
.. in the Database, as that "Array" as a String.
So how do i properly SAVE this JSON into the MySQL please? (So that i can later retrieve it back as a JSON and read.)