Re: newbie needs help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



   Good catch on the non-list reply, Richard.  I didn't even notice that.


On 4/30/07, Richard Davey <rich@xxxxxxxxxxxxx> wrote:

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"




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux