<?php
include 'koneksi.php';

$data = [
  'baik' => 0,
  'cukup' => 0,
  'kurang' => 0
];

$query = mysqli_query($conn, "SELECT rating, COUNT(*) as total FROM survey GROUP BY rating");
while ($row = mysqli_fetch_assoc($query)) {
  $data[$row['rating']] = $row['total'];
}

echo json_encode($data);
?>
