I have 2 php arrays which I am encoding into json with json_encode
and $mysqli->real_escape_string
. Now, the output of these two arrays after json_encode is:
{\"arg1\":\"char*\",\"arg2\":\"char*\"}{\"arg1\":\"abc\",\"arg2\":\"bca\"}
Then, I am inserting this into mysql with a query. But I am getting the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\"arg1\":\"char*\",\"arg2\":\"char*\"}, {\"arg1\":\"abc\",\"arg2\":\"bca\"})' at line 1
What is the way I put this json into mysql?
Mysql query
"UPDATE test_info SET java_auto_frame=$frame_auto, java_manual_frame=$frame_manual, java_testcase=$testcases, param_types=$param_types, param_examples=$param_examples WHERE qid=$qid"
where, $param_types is the first json encoded array and $param_examples is the second one.