score:1

Accepted answer

Remember that json_encode must be used once:

foreach($present_g as $row) {
    $value = $row['present'];
    $datetime = $row['date'] * 1000; // convert from Unix timestamp to JavaScript time
    // Also remove quotes here, you don't need a string
    $data[] = [$datetime, $value];
}  
$result = json_encode($data);
echo $result;

Related Query

More Query from same tag