<?php
include "config/db.php";

$hero = mysqli_fetch_assoc(mysqli_query(
    $con,
    "SELECT * FROM site_content WHERE section_name='hero'"
));

$about = mysqli_fetch_assoc(mysqli_query(
    $con,
    "SELECT * FROM site_content WHERE section_name='about'"
));

$services = mysqli_query($con, "SELECT * FROM services");

$projects = mysqli_query($con, "SELECT * FROM projects");
?>

<!DOCTYPE html>
<html>

<head>
    <title>Portfolio</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
</head>

<body>

    <!-- HERO SECTION -->

    <section class="hero">

        <h1><?php echo $hero['title']; ?></h1>

        <h2><?php echo $hero['subtitle']; ?></h2>

        <img src="uploads/<?php echo $hero['image']; ?>" width="300">

    </section>

    <!-- ABOUT SECTION -->

    <section class="about">

        <h2><?php echo $about['title']; ?></h2>

        <p><?php echo $about['description']; ?></p>

        <img src="uploads/<?php echo $about['image']; ?>" width="300">

    </section>

    <!-- SERVICES -->

    <section>

        <h2>Services</h2>

        <?php while ($row = mysqli_fetch_assoc($services)) { ?>

            <div>

                <h3><?php echo $row['service_name']; ?></h3>

                <p><?php echo $row['price']; ?></p>

                <p><?php echo $row['description']; ?></p>

            </div>

        <?php } ?>

    </section>

    <!-- PROJECTS -->

    <section>

        <h2>Projects</h2>

        <?php while ($row = mysqli_fetch_assoc($projects)) { ?>

            <div>

                <h3><?php echo $row['project_name']; ?></h3>

                <img src="uploads/<?php echo $row['image']; ?>" width="300">

            </div>

        <?php } ?>

    </section>

</body>

</html>