如何显示 2 个表中具有相同 ID 的多个图像

问题描述 投票:0回答:0

我正在尝试显示具有相同 ID 的多个图像

这是我的代码:

<?php
if (isset($_GET["img_code"]) && !empty($_GET["img_code"])) {

    include 'database.php';

    $query = mysqli_query($conn, "SELECT * FROM images WHERE img_code = '" . $_GET["img_code"] . "'");

    if (mysqli_num_rows($query) > 0) {
        while ($row = mysqli_fetch_assoc($query)) {
            $image = 'photos/' . $row["image"];
?>
            <div class="img">
                <img src="<?php echo $image; ?> " class="img-fluid" />
            </div>

<?php
        }
    }
}
?>

This is my first table in database

And the second is this

php html jquery ajax phpmyadmin
© www.soinside.com 2019 - 2024. All rights reserved.