开发者

sort a list from highest to lowest

开发者 https://www.devze.com 2023-03-24 12:01 出处:网络
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 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

精彩评论

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