Jump to content

[SOLVED] Sorting and summoning results from Database


Recommended Posts

Hey all, n00b to this forum! :] Ok I have a problem here goes:  I am building a website for a band, the homepage will list up-coming shows they are to play organised so that the closest date is at the top, and a maximum of 5 results are to be displayed.  If the date has been and gone it is to appear in the previous shows section in order of the most recently played.  I am confused as to how I should organise the list by date since the date is entered manually, will MySQL understand the date format?  I am using PHP4 and MySQL 5 I believe.  Any assistance would be much appreciated, many thanks. 

You can see the following

 

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-sub

 

or my favorites

 

TO_DAYS function just abstract/add the date you want and use FROM_DAYS with combination with the date format your accpecting

Thanks for the replies guys, maybe I didn't make myself clear sorry! There are two sections: Up-Coming Shows is to display the shows that are to be played with the closest show at the top, only 5 results are to be displayed.  The other section is the previous shows section that has all the shows that have been played previously (so once the date has been and gone in the Up-Coming Shows section it will appear here automatically with the most recent at the top).  I hope this makes things clearer!  The other question was how should the date be entered into the database since the results are to be ordered by the date?

 

Many thanks!!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.