...

View Full Version : playing with date function, IF Date is between..



jarv
07-16-2008, 11:42 AM
In my code below, I would like to add a bit of code to say:
IF $HeaderDate is between 6 days of today's date THEN change the <div class="entry_header">



echo <<<EOF
<a title="$HeaderID" id="$HeaderID" name="$HeaderID"></a>
<div class="entry_header">
<b>Header Name:</b> $HeaderName <a href="edit.php?HeaderID=$HeaderID"><img src="images/picture_edit.png" border="0" /></a> <a href="upload.php?HeaderID=$HeaderID"><img src="images/picture_right.png" border="0" /></a><br />
<b>Country:</b> <a href="http://www.avert.org/photo_search.php?search_keyword_id=&search_country_id=country-$CountryID&page_type=thumbnails&search=search" target="_blank">$Country</a> <b>Keywords:</b>
EOF;
//loop through Keywords
$i = 0;
while ($row1 = mysql_fetch_array($result2))
{
if ($i++ > 0)
{
echo ', ';
}
$Keyword = $row1['keyword'];
$KeywordID = $row1['keyword_id'];
echo '<a href="http://www.avert.org/photo_search.php?search_keyword_id='.$KeywordID.'&search_country_id=&page_type=thumbnails&search=search" target="_blank" >'.$Keyword.'</a>';
echo ' <a href="editkeywords.php?HeaderID='.$HeaderID.'">[Edit]</a>';
}


echo '<br />';
echo '<b>PhotoID:</b> '. $PhotoID .'<br />';
echo '<b>Header Photo No:</b> '. $HeaderPhotoNo .'<br />';
echo '<b>Header Date:</b> '.$HeaderDate.'<br />';
echo '<img src="headers/'.$HeaderImage.'">';
echo '</div>';
echo '</div>';

}

jarv
07-16-2008, 12:04 PM
basically, when I add a new record to the database, from the date it goes in and 6 days onwards I want to change the <div class="header"> to something else

jarv
07-16-2008, 01:20 PM
why doesn't this work?



echo <<<EOF
<a title="$HeaderID" id="$HeaderID" name="$HeaderID"></a>
if $HeaderDate = date("d")+6
<div class="entry_header">
else
<div class="entry_header">
<b>Header Name:</b> $HeaderName <a href="edit.php?HeaderID=$HeaderID"><img src="images/picture_edit.png" border="0" /></a> <a href="upload.php?HeaderID=$HeaderID"><img src="images/picture_right.png" border="0" /></a><br />
<b>Country:</b> <a href="http://www.avert.org/photo_search.php?search_keyword_id=&search_country_id=country-$CountryID&page_type=thumbnails&search=search" target="_blank">$Country</a> <b>Keywords:</b>
EOF;
//loop through Keywords
$i = 0;
while ($row1 = mysql_fetch_array($result2))
{
if ($i++ > 0)
{
echo ', ';
}
$Keyword = $row1['keyword'];
$KeywordID = $row1['keyword_id'];
echo '<a href="http://www.avert.org/photo_search.php?search_keyword_id='.$KeywordID.'&search_country_id=&page_type=thumbnails&search=search" target="_blank" >'.$Keyword.'</a>';
echo ' <a href="editkeywords.php?HeaderID='.$HeaderID.'">[Edit]</a>';
}


echo '<br />';
echo '<b>PhotoID:</b> '. $PhotoID .'<br />';
echo '<b>Header Photo No:</b> '. $HeaderPhotoNo .'<br />';
echo '<b>Header Date:</b> '.$HeaderDate.'<br />';
echo '<img src="headers/'.$HeaderImage.'">';
echo '</div>';
echo '</div>';

}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum