How to write array value into the database?

Hi all , help with the issue.
There is json response like:


Can't write to database value with Par[]
The first part of the values dat I can bring (example below), but how can I be with Par[] ?
$json = json_decode($str);
foreach ($json->dat as $a) 

$query = "INSERT IGNORE INTO `test` (`id`,`phone`,`name`,`city`,`address`) VALUES ('".$a->Id."','".$a->phone."','".$a->name."','".$a->city."','".$a->address."')";
$res=mysql_query($query)or die (mysql_error());

July 9th 19 at 13:48
2 answers
July 9th 19 at 13:50
And where you want to get these fields?
As said in the comments - turn in JSON back.
and looking at the code - like the nichrome shouldn't work, you have $a takes the value a string, and you get them later as an object of use, or I don't see a big missing piece of code? Get toric if the data always come in this form - it is easier sehardcore conversion $json->dat->par = json_encode($json->dat->par). I wouldn't do, but what you use deprecated code for you.
July 9th 19 at 13:52
It is necessary that all the values in the array par was recorded in one field(upper limit value) , the table test

Find more questions by tags MySQLPHPProgramming