<?php
include 'konak.php';
$settid = $_POST['id'];
$query = "SELECT id, name, serviceid, configblob, userdevice, status, tgl FROM data WHERE iduser='".$settid."' ";
$data  = mysqli_query($koneksi, $query);
$res = [];
while ($row = $data->fetch_assoc()) {
    $key = $row["id"];
    $res[$key] = [
        "work"    => $row["id"],
        "name"    => $row["name"],
        "serviceid" => $row["serviceid"],
        "configblob" => $row["configblob"],
        "userdevice" => $row["userdevice"],
        "status" => $row["status"],
        "tgl" => $row["tgl"]
    ];
}
header('Content-Type: application/json');
echo json_encode($res);
die();
?>