php – 从数据库中获取数据后如何在div中滑动

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 从数据库中获取数据后如何在div中滑动脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图找到如何从数据库提取数据后滑动数据块.
我尝试了很多,但没有得到结果.请帮助我找出解决方
这是我的代码

<htML>
<head>

</head>
<body>
<?PHP 
$servername="localhost";
$username="root";
$password="";
$db="lalcoresidency";

$conn=MysqLi_connect($servername,$username,$password,$db);

if(!$conn){
    die("connection Failed:".MysqLi_connect_error());
}
?>
<div class="flexslider">
<ul class="slides">
<?PHP
$query="select * From testimonial order by r_id desc";
$result = MysqLi_query($conn,$query);

while($row=MysqLi_fetch_array($result)){
    ?>
    <li>
    <?PHP echo $row['review'];?>
    </li>
<?PHP
    }
?>


<script src="http://ajax.GOOGLEapis.COM/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $('.flexslider').carousel({
      interval: 3200
    });
  });
</script>
</body>

它已经花了我的时间,但我没有得到解决方案.这个代码只能逐行显示数据

my code output
"Loving Staff Welcoming and helpful... Kind and welcome the food is great. breakfast included."
"total value for money."
"Excellent facilITies with good location and very co-operative and efficient staff."
"Accommodation worth the money paid for... Staff were very helpful and in-house car hire rates were so reasonable."
"An excellent stay... Loved the stay and definitely look forward to keep going back for our next stay."

一个一个显示数据.但我想显示第一行数据,然后滑动后需要显示第二行.然后滑动第三行.
请帮我找到解决方

解决方法

那是因为.carousel没有在jQuery中定义.

它是jQuery的插件,您可以从他们的网站下载.

https://plugins.jquery.com/jcarousel/

另外别忘了关闭< div>和< ul>标签.

脚本宝典总结

以上是脚本宝典为你收集整理的php – 从数据库中获取数据后如何在div中滑动全部内容,希望文章能够帮你解决php – 从数据库中获取数据后如何在div中滑动所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。