SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!

  3. #3
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •