Jump to content

only display today's events from table


bradkenyon

Recommended Posts

i want to only display today's events, based on m/d/y using the date function

 

$today = date("m/d/y");
$query = "SELECT * FROM calendar_items WHERE date('m/d/y',strtotime(expiredate)) = $today";

 

expiredate is the column in the table which it holds the date it is held on, and i want to only display the events for that day to display.

 

so it automatically displays the days events according to today's date.

 

i bet i am going entirely in the wrong direction, but any help is appreciated.

Link to comment
Share on other sites

still not working.

 

today there is an event, but it doesn't send anything, today's event expiredate is: 2008-07-10 11:35:00

 

here is all the code.

<?php
require_once("../customemailer/htmlMimeMail.php");

include('../cgi-bin/newsinclude/db.php');
//date("m/d/y",strtotime($row['expiredate'])
$query = "SELECT * FROM calendar_items WHERE DATE(expiredate) = CURDATE()";
//$query = "SELECT * FROM calendar_items WHERE expiredate > NOW() ORDER BY expiredate";

$result=mysql_query($query);
if($result)
{
	?> <ul> <?
	while($row = mysql_fetch_array($result))
	{
		$i = 0;
		$t = 1;

		while($i <=0)
		{
			print '<p><strong>'.date("m/d/y",strtotime($row['expiredate'])).'</strong> - <a href="/events/?id='.$row['id'].'">'.$row['subj'].'</a> - <small>'.$row['location'].'</small></p>';
			//$message.= date("m/d/y",strtotime($row['expiredate']))."\t".$row['subj']."\t".$row['location']."\r\t\t".$row['body']."\r\r";
			$message.= $row['subj']."\t".$row['location']."\r".$row['body']."\r---------------------------------------------------------------------------------------------------------\r\r";
			$i++;
			$t++;
		}
	}

$email = 'no-reply@domain.com';

$mail = new htmlMimeMail();

$mail->setText($message);


$mail->setSubject('Faculty/Staff Events');

/**
* Sends the message.
*/
	$mail->setFrom($email);
	$result = $mail->send(array('morsebk@herkimer.edu'));
	//echo $result ? 'Mail sent!' : 'Failed to send mail';

}
else
{ 
	print 'There are no events.'; 
}
?>

 

 

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.