<h4 class="text-light"><b>Data KRW yang Sudah Terdaftar</b></h4>
<div class="card shadow p-2">
    <table class="table table-striped table-selected" id="myTable">
        <thead>
            <tr>
                <th>KRW</th>
                <th>Jumlah Penduduk</th>
                <th>Jumlah KK</th>
                <th>Aksi</th>
            </tr>
        </thead>
        <tbody>
            <?php $getKrw = $con->query("SELECT krw, COUNT(*) as jum FROM penduduk GROUP BY krw ORDER BY krw ASC");?>
            <?php foreach($getKrw as $data){?>
                <tr>
                    <td><?= $data['krw']?></td>
                    <td>
                        <a href="index.php?hal=penduduk&krw=<?= $data['krw']?>" class="btn btn-sm btn-warning">
                            <?= $data['jum']?>
                        </a>
                    </td>
                    <td>
                        <?php
                            $getKK = $con->query("SELECT COUNT(*) AS jum FROM penduduk WHERE krw = '$data[krw]' and hubungan_keluarga = 'KK'")->fetch_assoc();
                        ?>
                        <?= $getKK['jum']?>
                    </td>
                    <td>
                        <a href="pages/print_kk.php?krw=<?= $data['krw']?>" class="btn btn-sm btn-warning">Print ALL KK</a>
                    </td>
                </tr>
            <?php }?>
        </tbody>
    </table>
</div>
<script>
    $(document).ready( function () {
        $('#myTable').DataTable({
            order: false
        });
    } );
</script>