加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 22:26:17 所属栏目:PHP教程 来源:网络整理
导读:我试图找到如何从数据库中提取数据后滑动数据块. 我尝试了很多,但没有得到结果.请帮助我找出解决方案 这是我的代码 htmlhead/headbody?php $servername="localhost";$username="root";$password="";$db="lalcoresidency";$conn=mysqli_connect($servername,$
我试图找到如何从数据库中提取数据后滑动数据块.
我尝试了很多,但没有得到结果.请帮助我找出解决方案
这是我的代码

<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>标签.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读