Hellow, I have a name Column and This is My json:
[{"id":"26","answer":[{"option":"3","text":"HIGH"}],"type":"3"},
{"id":"30","answer":[{"option":"3","text":"LOW"}],"type":"3"},
{"id":"31","answer":[{"option":"3","text":"LOW"}],"type":"3"},
{"id":"32","answer":[{"option":"3","text":"HIGH"}],"type":"3"},
{"id":"33","answer":[{"option":"3","text":"HIGH"}],"type":"3"},
{"id":"34","answer":[{"option":"3","text":"HIGH"}],"type":"3"},
{"id":"40","answer":["Number 3"],"type":"2"}]
Why I Can't echo answer With This Code:
<?php
$jsonurl='C:\wamp64\www\library\json.json';
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json, true);
foreach ($json_output as $trend){
echo $trend['id']."\n"; // OK
//echo $trend['answer']."\n"; // Error
echo $trend['type']."<br />"; // OK
}
?>
json_decode()to make this an php array and then work you way into sql. From there you have too many option to be able to answer your question specificly.$json = '{"foo-bar": 12345}';, But my Exaple is Defference, And I want to Select That json Column Automaticaly and I Have Radio Buttons too.