Jump to content

Calculating when a Date has passed


jester626

Recommended Posts

I managed to get my previous problem worked out with some help from the fine folks here. I am now back again looking for more help.

To ReCap:
I have a DB with a field called FollowUpDate and the data is in MySQL DATE format (YYY-MM-DD). I have managed to restrict the data that comes out of the DB by using the following:

WHERE FollowUpDate < DATE_SUB(NOW(), INTERVAL -5 DAY)

Now comes the part I am stuck at. I am trying to figure out how to do some sort of IF statement that if the day has already passed to display a flashing animated gif to let me know it is past due.

Anyone willing to give me a hand with the If statement?

Thanks



Link to comment
Share on other sites

not sure if this is what you're asking for but it might get you started

[code]
<?php
$today = date('Y-m-d');

$result = mysql_query("SELECT * FROM yourTable WHERE FollowUpDate < DATE_SUB(NOW(), INTERVAL -5 DAY)") or die(mysql_error());

while($row=mysql_fetch_array($result) {
if ($row['FollowUpDate'] < $today) {
//display pic
} else {
//don't display pic
}
}
?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.