
<?php include("includes/db.php"); ?>
<?php include("includes/header.php"); ?>
<?php include("includes/nav.php"); ?>

<h1>Nasza oferta</h1>

<?php
$sql = "SELECT * FROM uslugi";
$result = mysqli_query($conn, $sql);

if (!$result) {
    die("Błąd zapytania: " . mysqli_error($conn));
}

if (mysqli_num_rows($result) > 0) {
    echo "<div class='oferta'>";

    while ($row = mysqli_fetch_assoc($result)) {
        echo "<div class='usluga'>";
        echo "<h2>" . htmlspecialchars($row['nazwa_uslugi']) . "</h2>";
        echo "<p>" . htmlspecialchars($row['opis']) . "</p>";
        echo "<p><strong>Cena:</strong> " . $row['cena'] . " zł</p>";
        echo "<p><strong>Czas trwania:</strong> " . $row['czas_trwania'] . " min</p>";
        echo "</div>";
        
    }

    echo "</div>";
} else {
    echo "<p>Brak dostępnych usług.</p>";
}
?>

<?php include("includes/footer.php"); ?>