2014-01-19 38 views
0

如何將訂單從最大到最小?MySQL排序較大ID

我使用:

mysqli_query($con, "SELECT * FROM builds 
        WHERE approved = 'yes' AND ORDER BY build_id LIMIT 0, 10"); 

,但即時通訊歌廳此錯誤:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\pcbuilds\index.php on line 9 

任何方式使其工作?

回答

1

您的查詢似乎錯了,你已經和alone.remove這一點,

SELECT * FROM builds 
       WHERE approved = 'yes' ORDER BY build_id DESC LIMIT 0, 10 
+0

感謝奏效但第一個結果有最小的ID –

+0

@MeletisFlevarakis看我的編輯,把DESC –

0

你會使用desc關鍵字得到最大的以最低:

SELECT * 
FROM builds 
WHERE approved = 'yes' 
ORDER BY build_id DESC 
LIMIT 0, 10;