【发布时间】:2021-04-09 18:48:48
【问题描述】:
每次我尝试加载下面的页面时,图像都不会显示。我在 SQL 数据库中有图像名称,并且图像文件夹与我的 index.php 位于相同的路径中。
<div class="container-fluid">
<div class="col-md-12">
<div class="row">
<div class="col-md-6">
<h2 class="text-center">Products</h2>
<?php
$query = "SELECT * FROM product";
$result = mysqli_query($connect,$query);
while ($row = mysqli_fetch_array($result)) {?>
<form method="get" action="index.php?id=<?= $row['id'] ?>">
<img src="img/<?= $row['image'] ?>" style='height: 150px;'>
<h2><?= $row['name']; ?></h2>
<h2><?= $row['price']; ?></h2>
</form>
<?php }
?>
</div>
<div class="col-md-6">
<h2 class="text-center">Shopping Cart</h2>
</div>
</div>
</div>
</div>
</body>
</html>
【问题讨论】:
-
有错误吗?你做过 var_dump($row);看看数据有没有? html长什么样子?