gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 07:43:53 26 4
gpt4 key购买 nike

我试图找到如何在从数据库中获取数据后滑动数据 block 。我尝试了很多但没有得到结果。请帮助我找出解决方案这是我的代码

<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中滑动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37208271/

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