如何显示根据下面显示的数据计数?
我必须根据数据库中可用的数据显示以下代码片段
<div id="testimonial-row">
<div id="testimonial">
<ul>
<li>"Hello World"</li>
</ul>
</div>
<div id="testimonial">
<ul>
<li>"Hello World"</li>
</ul>
</div>
<div id="testimonial">
<ul>
<li>"Hello World"</li>
</ul>
</div>
</div>
也就是说,每次数据计数(此处为 hello world)变为时,都应创建
大于 3,因此,如果数据计数为“16”,则
应创建 6 次,所有数据显示在创建的 6 次中
标签那么有人可以告诉我如何实现 for 循环以在 PHP 中实现这一点吗?
I have to display below snippet according to data available in DB
<div id="testimonial-row">
<div id="testimonial">
<ul>
<li>"Hello World"</li>
</ul>
</div>
<div id="testimonial">
<ul>
<li>"Hello World"</li>
</ul>
</div>
<div id="testimonial">
<ul>
<li>"Hello World"</li>
</ul>
</div>
</div>
That is, the <div id="testimonial-row">
should be created everytime the count of data (here, hello world) becomes greater than 3, hence in this way if the data count is "16" the the <div id="testimonial-row">
should be created 6 times with all the data displayed in created 6 <div>
tags
So could some one tell me how to implement the for loop to make this happen in PHP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我正确理解你的问题:
If I understand your question correctly:
您不应使用 id="testimonial-row" 或 id="testimonial"。而是使用 class="testimonial-row"。
You should not use id="testimonial-row" or id="testimonial". Instead use class="testimonial-row".
这是一些代码
Here's some code