Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 455915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:25:09+00:00 2026-05-12T22:25:09+00:00

Okay guys! Right now, I am using Descending for my data because i want

  • 0

Okay guys! Right now, I am using Descending for my data because i want the dates from newest to oldest, but I want the entries from that data to be oldest to newest. So how can I do this, especially since I am using DESC in my query. Basically descend the <li> portions

        $sql = "SELECT $column_name, DATE(DATEandTIME) as Date FROM Codes WHERE DATEandTIME >= DATE_SUB(CURDATE(), INTERVAL 3 DAY) ORDER BY DATEandTIME DESC";
        $results = mysql_query($sql) or die(mysql_error());
        $prev_date = null;


while ( $row = mysql_fetch_array($results) ) {
    if( $row['Date'] != $prev_date ) {
        echo "</ol>";
        echo $row['Date'];
        echo "<ol>";
        $prev_date = $row['Date'];
    }
    echo "<li>" . $row[$column_name]  . "</li> " . $row['DATEandTIME'];
}
    echo "</ol>";

Output:

2009-11-13

   1. Green
      2009-11-13 17:09:
   2. 35TQTTX
      2009-11-13 16:27:
   3. 422AMKF
      2009-11-13 14:42:
   4. 35gqedu
      2009-11-13 14:03:
   5. 15T9YT6
      2009-11-13 13:42:
   6. 41TBK99
      2009-11-13 13:38:47
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:25:09+00:00Added an answer on May 12, 2026 at 10:25 pm

    You can order your SQL query by multiple criteria simultaneously. Try changing your ORDER BY clause from this:

    ORDER BY DATEandTIME DESC
    

    to this:

    ORDER BY `Date` DESC, TIME(DATEandTIME) ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay guys, I am working hashmap, using one of my classes as Key. My
Okay, here goes. Stack Overflow virgin here but hopefully you guys will be able
Okay, some Guys will know what i mean and edit my Question but they
Okay guys I have a question about positioning tables within DIV's using CSS. I
Okay guys, I'm sure this has a very simple solution but my searches are
Okay guys I have a database I have been working on for days now.
Okay, I have a question guys. I want to remote upload (copy an image
Hello guys I'm using C and GTK+ 2 I want to make a simple
Hye guys. Okay. I have done this coding. But it seems have error. Can
Okay guys, I have read through all the other posts and question on jQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.