Results 1 to 5 of 5
  1. #1
    ABW Ambassador AddHandler's Avatar
    Join Date
    January 19th, 2005
    Posts
    1,270
    $sql ORDER by date
    I am trying to get this script to not only order by date but put the oldest first instead of the newest...

    -----

    $sql ORDER by date

    -----

    any one have any ideas?
    Thanks!

  2. #2
    Resident Genius and Staunch Capitalist Leader's Avatar
    Join Date
    January 18th, 2005
    Location
    Florida
    Posts
    12,817
    Off the top of my head, 99% chance it's going to be DESC (descending) (put that after DATE)...

    I would have thought it'd be ASC (ascending) but I just found a site that says ASC's the default condition, so if it's doing it backwards from what you want, it's gotta be DESC.
    There is no knowledge that is not power. ~Hemingway

  3. #3
    I like traffic lights
    Join Date
    January 18th, 2005
    Location
    Southern hemisphere - away from Fukushima
    Posts
    2,936
    yup.

    order by date desc

  4. #4
    ABW Ambassador AddHandler's Avatar
    Join Date
    January 19th, 2005
    Posts
    1,270
    Yep that was it...

    But it wasn't exactly it... it was :::
    $sql ORDER by date DESC which sorted the records by Newest First...
    So changing it to
    $sql ORDER by date ASC sorted it by Oldest First which is what I wanted...

    Thanks Leader!!

  5. #5
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    I think the DATE function orders by Unix date so ASC is correct in this case because the oldest one ie one entered in on an earlier date would have a 'lower' Unix number than a more recent addition...

    Oscar
    My DataFeed Scripts - php datafeed scripts for your site
    Shareasale datafeed scripts - to display Shareasale datafeeds
    Linkshare datafeed scripts - for multiple Linkshare merchants

  6. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Event Date vs. Posting Date
    By Rodski in forum Commission Junction - CJ
    Replies: 4
    Last Post: November 18th, 2005, 11:59 AM

Posting Permissions

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