Jump to content

do not display expired events


bradkenyon

Recommended Posts

i am trying to only display the events that are not expired.

 

i was thinking that i could do an if statement within the loop, testing if the date is less than the current date, then do not display.

 

any help would be appreciated.

while($row = mysql_fetch_array($result))
{
	$i = 0;
	$t = 1;

	while($i <=0)
	{
		if($row['expiredate'] > date("Y-m-d",time()))
		{
			print '<li><strong>'.date("m/d/y",strtotime($row['expiredate'])).'</strong> - ';
			if($row['moreurl'] != '')
			{
				print '<a href="'.$row['moreurl'].'" target="blank">'.$row['subj'].'</a> - '.$row['location'].'';
			}
			else
			{
				print $row['subj'].' - '.$row['location'];
			}
			print '</li>';
			$i++;
			$t++;
		}
	}
}

Link to comment
https://forums.phpfreaks.com/topic/100513-do-not-display-expired-events/
Share on other sites

I'm looking for the event to stay until 11:59pm of that date, so people can see what happened that day, even if the event was over for a couple hours.

 

then your field expiredate should be adjusted to equal 11:59:59 of the day you want to expire so that NOW() won't trap em.

 

Or

you can avoid NOW() and use php's mktime function to make it 11:59:59 of today

As you mentioned before, w/ the query

 

SELECT * FROM events WHERE expiredate > NOW()

 

is there anyway you can modify the query so it displays the event that has the same date, for example....

 

Red Cross Blood Drive 4/10/2008

 

Today's date is 4/10/2008.

 

I want to display that event until the day is over, I was thinking you could modify the query like this...

 

SELECT * FROM events WHERE expiredate > NOW() + 1

 

or

 

SELECT * FROM events WHERE expiredate >= NOW()

 

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.