我从我的mysql数据库回显这个列表,但我不想要子弹,所以我使用bootstrap list-group-item。我觉得我在列表标签的某个地方犯了一个非常愚蠢的错误,但我不确定。我仍然在我的名单旁边获得子弹。我没有将我所有连接到我的数据库的PHP都包括在内,因为这不是问题所在。
这就是我所拥有的,
<div class="panel panel-info">
<div class="panel-heading">Contents</div>
<ul class="list-group">
<li class="list-group-item">
<?php
basic connect to mysql database stuff here
}
$query = mysqli_query($dat, "SELECT * FROM Content ORDER BY ContentName") or die(mysqli_error($dat));
while($list = mysqli_fetch_array($query)){
echo"<li>";
echo"<a href = >";
echo $list['ContentName'];
echo"</a>";
echo "</li>";
}
mysqli_close($dat);
?>
</li>
</ul>
</div>
答案 0 :(得分:2)
您要在另一个li
内添加li
。它应该是 -
<ul class="list-group">
<?php
}
$query = mysqli_query($dat, "SELECT * FROM Content ORDER BY ContentName") or die(mysqli_error($dat));
while($list = mysqli_fetch_array($query)){
echo"<li class='list-group-item'>";
echo"<a href = >";
echo $list['ContentName'];
echo"</a>";
echo "</li>";
}
mysqli_close($dat);
?>
</ul>
答案 1 :(得分:0)
使用echo "<li class='list-group-item'>";
代替 <li>
,并在php代码之前删除<li>
。
<div class="panel panel-info">
<div class="panel-heading">Contents</div>
<ul class="list-group">
<?php
basic connect to mysql database stuff here
}
$query = mysqli_query($dat, "SELECT * FROM Content ORDER BY ContentName") or die(mysqli_error($dat));
while($list = mysqli_fetch_array($query)){
echo "<li class='list-group-item'>";
echo "<a href ='www.example.com' >";
echo $list['ContentName'];
echo "</a>";
echo "</li>";
}
mysqli_close($dat);
?>
</ul>
</div>