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

Link to comment
Share on other sites

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()

 

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.