I\'m using Zend Framework (1.12) and I\'d like to create a table based on a JSON file. I\'ve already created the table and its fields (they\'re all longtext for now), all it has
Your json data has the top level key 'Actie', so you need to be looping through $my_arr->Actie
.
You can simplify your code to just:
$actieurl = "http://creative3s.com/thomas/nmdad/actie.json";
$my_arr = json_decode(file_get_contents($actieurl));
$db = new Zend_Db_Adapter_Pdo_Mysql(array(
'host' => 'localhost',
'username' => 'root',
'password' => NULL,
'dbname' => 'zf-tutorial'
));
foreach($my_arr->Actie as $row){
$db->insert('testerdetest', (array)$row);
}