Hellow, ich habe eine name
Säule und das ist mein json:Echo json Array VIA PHP
[{"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"}]
Warum ich nicht answer
mit diesem Code Echo:
<?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
}
?>
Start durch einen Blick in 'json_decode()' machen dies zu einem PHP-Array und dann arbeiten Sie Art und Weise in SQL verwenden. Von da an haben Sie zu viele Möglichkeiten, Ihre Frage gezielt zu beantworten. –
Ich lese '$ json = '{" foo-bar ": 12345}';', Aber mein Beispiel ist Defference, und ich möchte diese json Spalte automatisch auswählen und ich habe Radio Buttons auch. –