Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-16-2008, 11:42 AM   PM User | #1
jarv
Banned

 
Join Date: Mar 2007
Posts: 1,523
Thanks: 116
Thanked 0 Times in 0 Posts
jarv can only hope to improve
Question playing with date function, IF Date is between..

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

Code:
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 is offline   Reply With Quote
Old 07-16-2008, 12:04 PM   PM User | #2
jarv
Banned

 
Join Date: Mar 2007
Posts: 1,523
Thanks: 116
Thanked 0 Times in 0 Posts
jarv can only hope to improve
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 is offline   Reply With Quote
Old 07-16-2008, 01:20 PM   PM User | #3
jarv
Banned

 
Join Date: Mar 2007
Posts: 1,523
Thanks: 116
Thanked 0 Times in 0 Posts
jarv can only hope to improve
why doesn't this work?

Code:
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>';

}
jarv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:37 AM.


Advertisement
Log in to turn off these ads.