August 5th, 2000, 01:22 PM
I have a database that uses two date fields for tracking information. The first field is for the addition of the record and the second is for the expiration.
I have a small section that I want to list records that will expire in the current week (or for that matter in the next 7 or 14 days). What is the syntax that I would use to call mySQL with to get that info.
Any help would be great.
August 5th, 2000, 01:42 PM
Check the syntax in the mysql manual, but this should be close:
$query="select * from tablename where expiredate>now() and subdate(expiredate,interval 7 day)<now()";
This will pull all records that expire between now and 7 days from now. Just change the 7 to 14 or whatever.
August 6th, 2000, 03:39 PM
Thank you - that worked like a <charm>! :-)