我一直在尝试从double_quotation数据库中的产品表中检索被视为产品的名称,图片和价格列。我尝试了所有可能找到的代码来检索它们,但是似乎没有任何效果,我保留了对我来说有意义的代码,请帮帮我。
<?php$Query="SELECT Name, Picture, Price from product";
$result = mysqli_query($Query, $database);
$database=mysqli_connect("localhost","root","")
if ( !($database))
{
header('location: index.php?problem=CannotConnectToServer');
exit ("couldn't connect to the server");
}
if (!mysqli_select_db ("double_quotation", $database))
{
header('location: index.php?problem=CannotConnectToDB');
exit ("couldn't open the database");
}
if(mysqli_num_rows($result)>0) {
while ($row=mysqli_fetch_assoc($result)) {?>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-4 p-b-50">
<div class="block2">
<div class="block2-img wrap-pic-w of-hidden pos-relative block2-labelnew">
<img src="<?php echo img/$row['Picture'];?>" alt="IMG-PRODUCT">
<div class="block2-overlay trans-0-4">
<a href="#" class="block2-btn-addwishlist hov-pointer trans-0-4">
<i class="icon-wishlist icon_heart_alt" aria-hidden="true"></i>
<i class="icon-wishlist icon_heart dis-none" aria-hidden="true"></i>
</a>
</div>
</div>
<div class="item-details block2-txt p-t-20">
<a href="product-detail-teapot.html" class="block2-name dis-block s-text3 p-b-5">
<?php echo $row['Name'];?> </a>
<br>
<span class="block2-price m-text6 p-r-5">
SR <?php echo $row['Price'];?></span>
</div>
</div>
</div>
</div>
<?php}
}
mysqli_close($database);?>
我希望输出是产品,但它向我展示了这一点:
0) { while ($row=mysqli_fetch_assoc($result)) {?> IMG-PRODUCT
SR