我希望数据按降序排列,但我在php中输出不正确

时间:2017-08-10 14:49:07

标签: php html

我希望数据按降序排列,但输出不正确。

<?php

$selxx = "select * from a_points where type='class' GROUP BY en_no DESC";
$exxx = $con->query($selxx);
$ai = 0;

while($fetp = $exxx->fetch_object())
{ 
    if($ai <= 4)
    {
        $ai++;  
    }
    else
    {
        break;
    }

    $points = 0;
    $temp = $fetp->en_no;
    $selt = "select * from a_points where en_no='$temp'";
    $ext = $con->query($selt);

    while($fett = $ext->fetch_object())
    {
        $points = $points + $fett->points;
    }
?>

<tr>
<td><?php echo $ai; ?></td>
<td><?php echo $fetp->en_no; ?></td>
<td><?php echo $fetp->st_name; ?></td>
<td><?php echo $points; ?></td>
</tr>

<?php } ?>

结果:

result

我想要的是什么:

1 150570116027 karan 97
2 160573116003 Ravi 70
3 15097116013 Krish 40
4 150570116002 Ishan 20

0 个答案:

没有答案