Re: newbie needs help

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

 



I do apologize for the non-list reply, I will make sure and keep that in there on the next emails. I checked this morning and there was only one image, so the second mymonth code did not execute, but I replaced the code with what Richard gave me and it works also. And about the {} brackets, I am having to teach myself PHP code while trying to update and maintain a preprogrammed website so most of the code I see and I am using is chopped up code from the old programmer (which he did not keep a very tidy code). I figure out what a line of code does and then try to manipulate the existing code into what I need, so my syntax comes from the old programmer and what he had.

On another note I want to say THANK YOU again, your response to my question blew my mind on how quickly you guys responded, I have posted questions and sent emails on some other programming sites and either takes a few days to hear back or I never get the answer I need. I will only be asking questions about PHP here from now on. You have a loyal user forever.

Ben

Daniel Brown wrote:

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


On 4/30/07, *Richard Davey* < rich@xxxxxxxxxxxxx <mailto: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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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