0
我试图以totalspent的升序列印出使用者名称和totalspent值。即,花费最多的用户将首先输出然后是下一个最高花费等。按升序列印表值
这是我当前的代码,但是,这似乎只输出单个表行无限次。
$query = "SELECT * FROM (
SELECT * FROM `members` ORDER BY `totalspent` DESC LIMIT 10) tmp order by tmp.totalspent asc";
$result = $mysqli->query($query);
while ($row = $result->fetch_assoc()) {
echo $row['name'] . " - $" . $row['totalspent'] . "<br/>";
}