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
https://forums.phpfreaks.com/topic/16044-calculating-when-a-date-has-passed/
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.