Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    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>';
    
    }

  • #2
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    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

  • #3
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    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>';
    
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •