Jump to content


Photo

Calculating when a Date has passed


  • Please log in to reply
2 replies to this topic

#1 jester626

jester626
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 30 July 2006 - 08:25 PM

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




As the old saying goes. "What does not kill you, makes you stronger". I prefer "What does not kill me, DIES!!!!!!!

#2 digitalgod

digitalgod
  • Members
  • PipPipPip
  • Advanced Member
  • 374 posts

Posted 30 July 2006 - 08:37 PM

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

<?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
}
}
?>


#3 jester626

jester626
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 30 July 2006 - 09:02 PM

After some minor Modification it worked like a champ,

Thanks.

P.S. the Mods were database specific.
As the old saying goes. "What does not kill you, makes you stronger". I prefer "What does not kill me, DIES!!!!!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users