在我的图像进入数据库之前,我将它们存储为静态,因此我将它们从数据库中提取出来。所以这是我的问题。虽然静态图像(不在数据库中)可以点击它们并自由地浏览它们,但现在我无法点击它并且我不知道从哪里开始?
图像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>
谢谢!
答案 0 :(得分:0)
在评论请求中发布此内容:
而不是:
echo "<p><img src='../images/" . ($row['image']) . "'" . " " . " />";
跟着:
echo "<a href='../images/".$row['image']."'><img src='../images/".$row['image']."' /></a>";