PHP & Bootstrap 5 Lesson

Bootstrap 5 Computer Lessons PHP Programming

video Link

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
    <title>Famous Actor</title>
</head>
<body>
    <div class="container">
        <div class="row">
            <?php
            $dbusername = "root";
            $dbpassword = "";
            $dbhost = "localhost";
            $dbname = "actor";
            $conn = new mysqli($dbhost, $dbusername, $dbpassword, $dbname);
            $sql = "SELECT name, country, image FROM actor";
            $result = $conn->query($sql);
            if ($result->num_rows > 0) {
                while ($row = $result->fetch_assoc()) {
            ?>
                    <div class="col-lg-3 col-12">
                        <h3>Name: <?php echo $row['name']; ?></h3>
                        <h4>Country: <?php echo $row['country']; ?></h4>
                        <img class="img-fluid" src="<?php echo $row['image']; ?>" alt="" srcset="">
                    </div>
            <?php
                }
            }
            $conn->close();
            ?>
        </div>
    </div>
</body>
</html>

Leave a Reply