Author Topic: Date Question....  (Read 274 times)

0 Members and 1 Guest are viewing this topic.

Offline xstaticTopic starter

  • Irregular
  • Posts: 1
    • View Profile
Date Question....
« on: September 15, 2007, 01:54:38 AM »
Hi!  Pretty new php user here, so bear with me.  I have a site with a subscription feature and it registers the date the subscription starts in the field "date_added"

I am wanting to create a script that will send an email reminding them of their need to renew when the subscription ends.  Here is the query I came up with.  I think I need help with the way I am formatting the date stuff in the WHERE clause.  Basically I am trying to bring up their account if the current date is exactly one year ahead of the date added (without respect to the time information.)

Code: [Select]
SELECT a.Email , u.fname , c.date_added FROM ptpl_accounts AS a
      LEFT JOIN ptpl_couponsubscription AS c ON c.user_id = a.ID
      LEFT JOIN ptpl_users AS u ON c.user_id = u.ID
      WHERE ADDDATE(c.date_added, INTERVAL 1 YEAR) = CURDATE()

Thanks for any help!!
« Last Edit: September 15, 2007, 01:56:53 AM by xstatic »