Page 1 of 1

Can you show the next available date from the database?

Posted: Thu Aug 19, 2010 7:04 am
by simonmlewis
This is related to a previous enquiry here.

We have a web site for racing cars, and it shows the Race Dates.

What we want to do is to show the date of the next Race Meeting, based on today's date.
ie. today is 19th August 2010.
There are 20 dates in the database going from 15th July 2010 through to 30 October 2010.

There might be a date of 25th August 2010 in there.

How do I make it pic out that date from all the others? I would have thought it's to do with converting the date to an str*, and then some maths. But am not quite sure how to go about this one.

Re: Can you show the next available date from the database?

Posted: Thu Aug 19, 2010 7:16 am
by requinix
If you simply store the dates then a mere

Code: Select all

...WHERE datefield > "today's date"...
in your SQL should be enough.

Re: Can you show the next available date from the database?

Posted: Thu Aug 19, 2010 7:22 am
by simonmlewis
Ohhh, and in theory then you can order them by date, and LIMIT ? Like you do with Page Numbering?