Re: newbie needs help
| From: | Richard Davey | Date: | Mon, 30 Apr 2007 22:19:15 +0000 |
| Subject: | Re: newbie needs help | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254162@lists.php.net to get a copy of this message | ||
Ben Clapp wrote:
Thank you again for the help, it does work now but with an issue, here is the code that i have for it right now:You should always reply to the php mailing list, so other people can benefit from the answers we give.
With this it works, but i am sure that when mymonth == 5 (may 1st, tomorrow) I will have two of the same pictures.You are right, you will. Because you're running the mothers day check twice, once with the 'new' code I gave you, and once with your old code.
If I take out this bit of code from the above code: then NOTHING shows up. Am I not getting something right or is there something elese that is getting in the way or is something not being completed?You've got missing { } around your if blocks. You also could make the code a lot more tidy / easy to read. Try the following (it replaces entirely the code you emailed me, swap all of it for this) <?php
$mymonth = date('m');
// novenmber is pancreatic cancer month
if ($mymonth == 11)
{
?>
<tr><td align="center" bgcolor="#ffffff"><a href="http://pancan.com/Patient/pancreatic.html" target="_blank"><img src="../images/ads/pancanNov_banner.jpg" width="777" height="182" border="0"></a></td>
</tr>
<?php
}
$start_date = strtotime('13 April '.date("Y"));
$end_date = strtotime('13 May '.date("Y"));
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
?>
<tr><td align="center" bgcolor="#ffffff"><a href="../images/passportad/mothersdayBanner.jpg" target="_blank"><img src="../images/passportad/mothersdayBanner.jpg" width="771" height="112" border="0" /></a></td>
</tr>
<?php
}?> Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window"