Jump to content


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


Calculating when a Date has passed

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:


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?


Share this post

Link to post
Share on other sites
not sure if this is what you're asking for but it might get you started

$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

Share this post

Link to post
Share on other sites
After some minor Modification it worked like a champ,


P.S. the Mods were database specific.

Share this post

Link to post
Share on other sites


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.