34 lines
803 B
PHP
34 lines
803 B
PHP
<?php
|
|
// Find multiple country bans
|
|
function topTen($db) {
|
|
$countrybans = mysqli_query($db, "SELECT country,COUNT(*) count FROM bans GROUP BY country ORDER BY count DESC LIMIT 10");
|
|
while ($rows = mysqli_fetch_assoc($countrybans)) {
|
|
$topTen[] = $rows;
|
|
}
|
|
if (empty($topTen)) {
|
|
$topTen = array();
|
|
}
|
|
mysqli_free_result($countrybans);
|
|
return $topTen;
|
|
}
|
|
?>
|
|
<h2>Top 10 Countries</h2>
|
|
<div class='table'>
|
|
<div class='row'>
|
|
<div class='cell-header'>
|
|
Country
|
|
</div>
|
|
<div class='cell-header'>
|
|
Bans
|
|
</div>
|
|
</div>
|
|
<?php
|
|
$topTen = topTen($db);
|
|
foreach ($topTen as $value) {
|
|
echo '<div class="row">';
|
|
echo '<div class="cell">', $value['country'], '</div>';
|
|
echo '<div class="cell">', $value['count'], '</div>';
|
|
echo '</div>';
|
|
}
|
|
?>
|
|
</div>
|