Chartjs-Json_encode is not working (anymore)

1👍

This is your problem

foreach($vak as $vak)
    $vak = $vak->getCode();

You are destroying your $vak array in these commands.

Do not reuse the $vak variable all over the place. Try this instead.

$vaks = $q->getVakAll();

$data = array();
foreach($vaks as $vak){
    $code = $vak->getCode();
    $result = $q->getAanwezigheidVakkenPerJaar($value, $code); 
    foreach ($result as $row) {
        $data[] = $row;
    }
}

0👍

instead of print use : echo json__encode(array) die; hope this help.

Leave a comment