<!DOCTYPE html>
<html lang="tr">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <title>Kitaplar</title>
</head>

<body>
    <div class="col text-center" style="margin-top: 20px">
        <a href="kitap-ekle.php"><button class="btn btn-success" style="margin:auto;">Yeni Kitap Ekle</button></a>
        <a href="katalog.php"><button class="btn btn-info" style="margin:auto;">Katalog</button></a>
    </div>
    <table class="table" style="max-width: 1000px; margin: 20px auto">
        <thead class="table-dark">
            <tr>
                <th scope="col">Sıra</th>
                <th scope="col">Kitap Adı</th>
                <th scope="col">Yazar</th>
                <th scope="col">Profil</th>
                <th scope="col">Güncelle</th>
                <th scope="col">Sil</th>
            </tr>
        </thead>
        <?php
        require_once("_ayarlar.php");

        $sql = "SELECT * FROM kitap";

        $tablo = $vt->query($sql);

        while ($satir = $tablo->fetch_assoc()) {
            echo "<tr>";
            echo "<td>" . $satir["id"] . "</td>";
            echo "<td>" . $satir["kitap_ad"] . "</td>";
            echo "<td>" . $satir["yazar_ad"] . " " . $satir["yazar_soyad"] . "</td>";
            echo "<td><a class='btn btn-secondary' href='profil.php?id=" . $satir["id"] . "'>Kitap Profili</a></td>";
            echo "<td><a class='btn btn-primary' href='kitap-guncelle.php?id=" . $satir["id"] . "'>Güncelle</a></td>";
            echo "<td><a class='btn btn-danger' href='kitap-sil.php?id=" . $satir["id"] . "'>Sil</a></td>";
            echo "</tr>";
        }
        ?>
    </table>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>

</html>