gpt4 book ai didi

php - 是否可以添加来自数据库的 jQuery slider ?

转载 作者:行者123 更新时间:2023-11-29 23:28:53 26 4
gpt4 key购买 nike

我正在尝试从数据库中获取 jQuery slider ,以像 HTML 中一样显示它。

HTML 中的 slider :http://puu.sh/cCD3x/7421da5d3a.jpg

我的数据库:http://puu.sh/cCD5w/fe9465a903.png

这是我的代码:

<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<div data-thumb="../images/thumbs/slider1.jpg" data-src="../images/slider/slider1.jpg">
</div>
<div data-thumb="../images/thumbs/slider2.jpg" data-src="../images/slider/slider2.jpg">
</div>
<div data-thumb="../images/thumbs/slider3.jpg" data-src="../images/slider/slider3.jpg">
</div>
<div data-thumb="../images/thumbs/slider4.jpg" data-src="../images/slider/slider4.jpg">
</div>
</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>

我认为代码的工作原理:

                                                                                        <?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 "<a href='../images/".$row['image']."'><img src='../images/".$row['image']."' /></a>";
}
?>

感谢任何帮助!

最佳答案

 <?PHP
$sql = "SELECT image FROM product where productID=2";
$result = mysql_query($sql) or die(mysql_error($connection));
?>



<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<?PHP while($row = mysql_fetch_array($result)): //display the results ?>
<div data-thumb="../images/thumbs/<?PHP echo $row['image']; ?>" data-src="../images/slider/<?PHP echo $row['image']; ?>">
</div>
<?PHP endwhile; ?>

</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>

关于php - 是否可以添加来自数据库的 jQuery slider ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26728548/

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