query based on date 7 days later than today
Posted: Tue Jan 04, 2011 2:06 pm
I have a page set up on my site that pulls events from MySQL database based on a start date of today and brings in the following 5 events. I'm trying to adjust the code so that it pulls events that start 7 days or one week from today. Any ideas? Thanks.
Here is my current code:
<?
$query = "select * from site_textblocks where expiredate > $site->today and page = 'calendar' and caption2 = '1' order by date ASC LIMIT 0, 5";
$site->query($query);
while ($site->next_record()){
$headline = "" . $site->f(headline) ."";
$img3 = "" . $site->f(photo1) . "";
$startdate = $site->convertdate($site->f(date));
$description = nl2br($site->f(caption3));
$textid = "" . $site->f(textid) ."";
echo " <table width=\"100%\" cellpadding=\"5\"><tr><td bgcolor=\"#efeee0\"><img src=\"/images/camshots/$img3\" width=\"100\" valign=\"top\" align=\"right\" hspace=\"10\" vspace=\"10\"><br/><a href=\"/events.html\" style=\"text-decoration:none;\" >$headline</a><br />$startdate";
if ($site->f(date) != $site->f(expiredate)){
$enddate = $site->convertdate($site->f(expiredate));
print "<b> - $enddate</b>";
}
echo" $description<br /></td></tr></table>";
}
?>
Here is my current code:
<?
$query = "select * from site_textblocks where expiredate > $site->today and page = 'calendar' and caption2 = '1' order by date ASC LIMIT 0, 5";
$site->query($query);
while ($site->next_record()){
$headline = "" . $site->f(headline) ."";
$img3 = "" . $site->f(photo1) . "";
$startdate = $site->convertdate($site->f(date));
$description = nl2br($site->f(caption3));
$textid = "" . $site->f(textid) ."";
echo " <table width=\"100%\" cellpadding=\"5\"><tr><td bgcolor=\"#efeee0\"><img src=\"/images/camshots/$img3\" width=\"100\" valign=\"top\" align=\"right\" hspace=\"10\" vspace=\"10\"><br/><a href=\"/events.html\" style=\"text-decoration:none;\" >$headline</a><br />$startdate";
if ($site->f(date) != $site->f(expiredate)){
$enddate = $site->convertdate($site->f(expiredate));
print "<b> - $enddate</b>";
}
echo" $description<br /></td></tr></table>";
}
?>