2016-07-30 76 views
-2

我最近創建了一個顯示數據的表的論壇。論壇表排行幫助(PHP/HTML)

<div class="invis"> 
<div class="topic-top"> 
<table width="100%"><tr> 
<td width="54%" style="color:white;">Topic</td> 
</table> 
</div> 
<div class="topic-test"> 
<?php 
while($thread=mysql_fetch_assoc($forum)){ 
echo "<tr>"; 
echo "<td><a href='threads?id=".$thread['id']."' 
    class='btn'>".$thread['title']."</a></td><hr>"; 
echo "</tr>"; 
} 
?> 
</tr> 
</table> 
</div> 

當它顯示數據時,它會先變老(按id)。我如何讓它最先顯示最新?

+0

如果下面的答案之一回答了你的問題,這個網站的工作方式,你會「接受」答案,更在這裏:[*當有人回答我的問題時,我該怎麼辦?](http:///stackoverflow.com/help/someone-answers)。但前提是你的問題確實得到了回答。如果不是,請考慮在問題中添加更多詳細信息。 – FrankerZ

回答

0

使用MySQL在查詢中按ID排序。您可以通過條款here瞭解有關訂單的更多信息。

ORDER BY id DESC 

使用ORDER BY id ASC排序的方式相反。

+0

謝謝!像魅力一樣工作! – dukeispie