This topic is locked
[SOLVED]

 View records based on date

3/29/2011 9:54:32 AM
PHPRunner General questions
C
copper21 author

Hello All,
I am looking to show the records in my mysql database on the list page the entries that contain today and future dates. More specifically, I have a field "end_date"; and I would like the list page to show only the records of which the "end_date" is today or greater. So when the "end_date has passed, the record no longer shows up on the list page. I have been working with the "now()" feature in the SQL Query and can not get this to work. I am workign with mysql 5.5.9, PHPRunner 5.3
Thanks all in advance.

C
copper21 author 3/29/2011

I have tried:
SELECT

.

.

.

FROM Tablename

WHERE end_date >=NOW()
I dont show errors with this code, but I dont get back any records although there is a record with today's date in it. I am just using "Date" type in the mysql database. I assume that becuase it is not putting in any time, it lists 00:00:00 as the time making it less than and not equal. Like I mentioned before, I would like it to display through the end of today, not stop displaying at the beginning of the day.
Thanks again for anyone's help.

C
copper21 author 3/29/2011

I figured it out:
SELECT

.

.

.

FROM Tablename

WHERE (end_date >(DATE_SUB(NOW(),INTERVAL 1 DAY)))