<?php
$db = mysqli_connect('localhost', 'root', '', 'biblioteka');
?>
<!doctype html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Kwerenda 2</title>
    <style> td, th, table { border: 1px black solid; border-collapse: collapse}</style>
</head>
<body>
<h2>Kwerenda 2</h2>
<p>Kwerenda: <code>SELECT tytul, id_cz, data_odd FROM ksiazka JOIN wypozyczenia ON id_ks = id ORDER BY data_odd LIMIT 15;</code></p>
<?php
$query = "SELECT tytul, id_cz, data_odd FROM ksiazka JOIN wypozyczenia ON id_ks = id ORDER BY data_odd LIMIT 15;";
$result = mysqli_query($db, $query);
echo "<table>";
echo "<tr><th>Tytul</th> <th>Id Czyt</th><th>Data oddania</th></tr>";
while ($row = mysqli_fetch_assoc($result)) {
    echo "<tr>";
    echo "<td>" . $row['tytul'] . "</td><td>" . $row['id_cz'] . "</td><td>" . $row['data_odd'] . "</td>";
    echo "</tr>";
}
echo "</table>";
?>
</body>
</html>
<?php
mysqli_close($db);