Ok , i have written some scripts which pull info out of a mySQL database. How do i make it so that it is displayed with the most recently added at the top ?
THanks,
James
| SitePoint Sponsor |


Ok , i have written some scripts which pull info out of a mySQL database. How do i make it so that it is displayed with the most recently added at the top ?
THanks,
James





James,
Kevin's most recent article in his series (Part 9) describes in detail how to sort SQL results by an individual field, have a looksy
http://www.webmasterbase.com/article...d=228&pid=1025
Hope this helps!
------------------
Chris Bowyer – chris@mycoding.com
MyCoding.com: Visit for Launch Notification!
DomainMailings.com: Who Says All The Good Ones Are Taken?
MovieForums.com: Talk About Your Favorite Flicks!
Use the "Order by" clause in SQL
To list newest entries on top (Descending):
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
Select * from tblData order by datefld DESC
[/code]
To list oldest entries on top (Ascending):
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
select * from tblData order by datefld ASC
[/code]
Ascending is also the default.
------------------
Wayne Luke - Sitepoint Forums Administrator
Digital Magician Magazine - MetaQuark Creations (Coming Soon)
sitepoint@digitalmagician.com
Bookmarks