gpt4 book ai didi

PHP/MYSQL 不像 HTML 那样显示

转载 作者:行者123 更新时间:2023-11-30 22:55:12 25 4
gpt4 key购买 nike

在我的图像存储在数据库中之前,我将它们存储为静态的,所以我让它们来自数据库。所以这是我的问题。虽然静态图像(不在数据库中)您可以点击它们并自由移动它们,但现在我无法点击它而且我不知道从哪里开始?

图像 1-静态图像(HTML):http://puu.sh/cCywf/70ad438845.jpg

如你所见,我可以点击图片并将其放大

代码:

    <div class="wrapper">
<div class="main">
<div class="ser-main">
<h2 class="style">Gallery of honda</h2>
<div class="ser-grid-list img_style">
<div class="gallery1">
<a href="../images/ser_pic1.jpg"><img src="../images/ser_pic1.jpg" alt=""></a>
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<a href="../images/ser_pic2.jpg"><img src="../images/ser_pic2.jpg" alt=""></a>
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<a href="../images/ser_pic3.jpg"><img src="../images/ser_pic3.jpg" alt=""></a>
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<a href="../images/ser_pic4.jpg"><img src="../images/ser_pic4.jpg" alt=""></a>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>

现在我已经让它们来自数据库,它不允许我点击它们

图像:http://puu.sh/cCyzq/7d53fd37ea.jpg

代码:

            <div class="wrapper">
<div class="main">
<div class="ser-main">
<h2 class="style">Gallery of honda</h2>
<div class="ser-grid-list img_style">
<div class="gallery1">
<?php
$sql = "SELECT image FROM product where productID=1";
$result = mysql_query($sql) or die(mysql_error($connection));
while ($row = mysql_fetch_array($result)) //display the results
{
echo "<p><img src='../images/" . ($row['image']) . "'" . " " . " />";
}
?>

</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<?php
$sql = "SELECT image FROM product where productID=2";
$result = mysql_query($sql) or die(mysql_error($connection));
while ($row = mysql_fetch_array($result)) //display the results
{
echo "<p><img src='../images/" . ($row['image']) . "'" . " " . " />";
}
?>

</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<?php
$sql = "SELECT image FROM product where productID=3";
$result = mysql_query($sql) or die(mysql_error($connection));
while ($row = mysql_fetch_array($result)) //display the results
{
echo "<p><img src='../images/" . ($row['image']) . "'" . " " . " />";
}
?>

</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<?php
$sql = "SELECT image FROM product where productID=4";
$result = mysql_query($sql) or die(mysql_error($connection));
while ($row = mysql_fetch_array($result)) //display the results
{
echo "<p><img src='../images/" . ($row['image']) . "'" . " " . " />";
}
?>

</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>

谢谢!

最佳答案

根据评论请求发布:

代替:

echo "<p><img src='../images/" . ($row['image']) . "'" . " " . " />"; 

搭配:

echo "<a href='../images/".$row['image']."'><img src='../images/".$row['image']."' /></a>";

关于PHP/MYSQL 不像 HTML 那样显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26727648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com