<?php
require 'koneksi.php';
$con = open_connection();

require 'header.php';

$query = mysqli_query($con,"
SELECT
p.id_perkembangan,
m.nama AS nama_murid,
a.nama_aspek,
g.nama AS nama_guru,
p.deskripsi,
p.tanggal_penilaian

FROM perkembangan p

JOIN murid m
ON p.id_murid = m.id_murid

JOIN aspek_perkembangan a
ON p.id_aspek = a.id_aspek

JOIN guru g
ON p.id_guru = g.id_guru
");
?>

<div class="container mt-4">

<h2>Data Perkembangan Murid</h2>

<a href="tambah_perkembangan.php"
class="btn btn-primary mb-3">
Tambah Data
</a>

<table class="table table-bordered">

    <tr>
        <th>ID</th>
        <th>Murid</th>
        <th>Aspek</th>
        <th>Guru</th>
        <th>Tanggal</th>
        <th>Deskripsi</th>
    </tr>

    <?php while($data = mysqli_fetch_assoc($query)){ ?>

    <tr>
        <td><?= $data['id_perkembangan']; ?></td>
        <td><?= $data['nama_murid']; ?></td>
        <td><?= $data['nama_aspek']; ?></td>
        <td><?= $data['nama_guru']; ?></td>
        <td><?= $data['tanggal_penilaian']; ?></td>
        <td><?= $data['deskripsi']; ?></td>
    </tr>

    <?php } ?>

</table>

</div>
<?php include 'footer.php';?>