I store JSON data in a MySQL table using the following code. It works fine if JSON is short but breaks for longer text. "Field_json" is LONGTEXT.
$sql = sprintf("UPDATE mytable SET field_json = '$json_string' WHERE id = $userid"); $result = mysql_query($sql);
The error I get is:
Invalid query: you have an error in the SQL syntax; check the manual that matches your version of MySQL server for the correct syntax to use near 'G' "" Username ":" C0WB0Y "," LastName ":" "," identifier ": 31874363}, {" pathToPhoto ":" 22960 / ph ' in line 2
json php mysql
MotoTribe
source share