我想将一个 json 对象数组作为长文本插入到单个 mysql 记录中,但不确定这是可能的。
json响应是这样的:-
stdClass Object
(
[name] => Alex Xxx
[title] => Head of Something
[picture] => https://secure.gravatar.com/avatar/d19553c39a6b7d48decd50b3fe84a431?s=80&d=404
[location] => Slough, United Kingdom
[images] => Array
(
[0] => https://secure.gravatar.com/avatar/d19553c39a6b71?s=80&d=404
[1] => http://m3.licdn.com/mpr/360b418.jpg
)
[provider] => srptv
[email] => alex.xx@xx.com
)
我想将此作为文本添加到记录中。我试过这个,但它只在字段中插入一个数字 1。
$apiresult = mysql_real_escape_string(print_r(json_decode($jsonresponse)));
$mysql = "UPDATE `test` SET `first_api_pass_response` = '$apiresult' WHERE `data_content` = '$data_content'";
$addresults = mysql_query($mysql);
有任何想法吗?
谢谢
乔纳森