开发者

sort a list from highest to lowest

i have a script that posts the id's onto a page, the only problem is that it posts the highest id number last.

i would like it to post the highest id number first and the lowest last

heres my script

<th><font face="Ar开发者_如何学Pythonial, Helvetica, sans-serif">id</font></th> 

$f1=mysql_result($result,$i,"id");

<td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td>

this code above does a great job of getting the id from my mysql db

if this makes no sense please tell me and ill try to explain is in another way


Put this at the end of your query

Order by Id Desc


SELECT * FROM table WHERE 1 ORDER BY id DESC


That should be done in your SQL query.

Example:

SELECT * FROM table ORDER BY id DESC;

The ORDER BY clause will do perfectly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜