所以问题是当我尝试回显我的窗格时它工作正常,但每个结果都会得到一个窗格,我想做的是。假设每次调用一个选项卡时,我都希望在该选项卡中有 5 个结果。代码:
<?php
$sql = "select * from progress order by procent asc";
$query = mysqli_query($db,$sql) or die(mysqli_error($db));
$nums = mysqli_num_rows($query);
?>
<ul class="nav nav-tabs" id="myTab">
<?php
for($i = 1; $i <= $nums; $i++){
if($i == 1){
echo "<li class='active'><a href='#active".$i."'>".$i."</a></li>";
}else{
echo "<li><a href='#active".$i."'>".$i."</a></li>";
}
}
?>
</ul>
<div id="myTabContent" class="tab-content">
<?php
$y = 1;
$arr = array();
while($res = mysqli_fetch_array($query)){
if($y == 1){
echo '<div class="tab-pane active" id="active'.$y.'">';
}else{
echo '<div class="tab-pane" id="active'.$y.'">';
}
echo $res['workingon'];
if($res['procent'] == 100){
echo "<i class='icon-color icon-check icon'></i>".$res['procent']."%";
}else{
echo "<i class='icon-color icon-close icon'></i>".$res['procent']."%";
}
echo "</div>";
$y++;
}
?>
</div>
ul 包裹标签..
带有 id=mytabcontents 的 div 包装了结果 希望你为我糟糕的英语感到抱歉:) 问候 Cruelcrome