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 6554761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:44:17+00:00 2026-05-25T12:44:17+00:00

Basically I have a lot of data in a table and its creation date

  • 0

Basically I have a lot of data in a table and its creation date with it. I want to show all of the data from the table, however in its output it need to be in date order, and then with a heading of the month it was created in above it.

i.e.

January
data1
data2
data3

February
data4
data5

March
data6
data7
data8
data9

Is this possible from one query? I’m using php and mysql.

Thanks

Table Layout will be something like:

ID | Type | Content | User | Colour | Creation Date

It’s all theory at the moment, but I will be creating it later today and tomorrow. I just needed to know if it’s possible.

  • 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-25T12:44:18+00:00Added an answer on May 25, 2026 at 12:44 pm

    I’d simply add the month to the query, order the query by date, and then track the month during the output phase and insert a new heading every time the month changes:

    SELECT *, MONTH(thedate) AS month FROM thetable ORDER BY thedate;
    

    In the PHP:

    $lastmonth = "";
    while ($row = mysql_fetch_assoc($queryresult))
    {
      if (empty($lastmonth)) { $lastmonth = $row['month']; }
    
      if ($lastmonth != $row['month'])
      {
        $lastmonth = $row['month'];
        // print new month header
      }
    
      // print row
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering which is best here. I want to output data from a table
I basically have 7 select statements that I need to have the results output
Basically, I will need to combine product data from multiple vendors into a single
My site is going to have a credit system that basically works a lot
I have a Data intensive problem which requires a lot of massaging and data
I have a table my_table with these fields: id_a, id_b. So this table basically
First of all, I have no control over the database structure, etc. I need
I have an Excel spreadsheet with a table of data in it. The columns
I am making an app which basically presents data (from plist) to user in
I have a situation where I need to store some data that just won't

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.