Hi all,
I'm new to PHP and was wondering if someone could help me...

I need to write something so that when row "expire" (this is the date the account expires) is 5 days from expiring, a message shows up. I can format everything myself, I'm just drawing a blank at how to do this.


A basic skeleton ...


// Assume you have an expiry date stored as a timestamp.
// You've queried the database for the expiry timestamp on the account in question.
// Results have been put into $mysql_account_info using mysql_fetch_assoc().

// Check to see if the time now is equal to or greater than 5 days (in seconds) before the expiry time.
// The use of the word greater in the above sentence means in simple terms,
// the time is in the future or further forward than the expiry time minus 5 days.
if(now() >= ($mysql_account_info['Expiry_Timestamp'] - 60 * 60 * 24 * 5)) {

  echo 'account expiry soon...';



You can build up from that, if you have the expiry date stored as a string then you will have to use date functions in PHP such as creating a new date string 5 days in the past with mktime() and date() and plug that into the IF statement.

Would NOW() + interval 7 day work?

I think what you're asking is can you put the +7days on the other side, in which case yes you can.