sql >> Base de Datos >  >> RDS >> Mysql

Analizando JSON a la tabla MySQL

Sus datos json tienen la clave de nivel superior 'Actie', por lo que debe recorrer $my_arr->Actie .

Puede simplificar su código a solo:

$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);
}