我在模态中有一个表。我希望表格显示足球比赛的前 3 名射手。以下代码不返回表。非常感谢任何帮助!目前我正在尝试在 php 标签中回显该表,但我不确定这是否是最好的方法,我采用了这种方法,因为我希望从数据库中返回三行。
<div class="modal fade bd-example-modal-lg" id="homeleaderboard" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<h3 style="text-align: center;">Most Goals</h3>
<?php
$topgoals="SELECT player,panel.name,count(*) AS goalcount FROM fixtures
inner join panel
on fixtures.player=panel.id
where fixture='$fixture_id' and goal='1'
group by player
order by goalcount desc
limit 3";
$goalsresult=mysqli_query($conn,$topgoals) or die(mysqli_error($conn));
if(mysqli_num_rows($result)>0){
while($row=mysqli_fetch_assoc($result)){
$goalnames=$row['name'];
$goaltotal=$row['goalcount'];
echo "<div class='table-responsive'>
<table class='table table-striped table-bordered'>
<thead>
<tr>
<th>Player</th>
<th>Goals</th>
</tr>
</thead>
<tr>
<td>$goalnames</td>
<th>$goaltotal</th>
</tr>
</table>
</div>
";
}
}
?>
</div>
</div>
</div>
</div>
SMILET