在我的数据库中,我有一个名为 的表db_pilots
,我正在尝试查找来自国家/地区的飞行员总数,即来自 的飞行员总数GB
。它就是这样做的,但它是按location
而不是排序total
。我怎样才能做到这一点?
<?php
$country_info = DB::get_results('SELECT COUNT(pilotid) as total, location FROM'.TABLE_PREFIX.'pilots GROUP BY location DESC');
foreach($country_info as $country)
{
?>
<tr>
<td align="center"><img src="<?php echo Countries::getCountryImage($country->location); ?>" /></td>
<td align="center"><?php echo Countries::getCountryName($country->location); ?></td>
<td align="center"><?php echo $country->total;?></td>
</tr>
<?php
}
?>