Very frustrating Parse error on Html table creation, using time().

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karlectomy
    New Member
    • Sep 2007
    • 64

    Very frustrating Parse error on Html table creation, using time().

    Can anyone find the parse error on the fourth line of this stuff??

    [CODE="HTML"]
    <table><tr>
    <td>Date</td>
    <?
    var $thisDate = time(); //NOW
    var $day1 = (7*3600); //One more day
    for($i = 7; $i>=0; $i--)
    {
    $d = $thisDate-($i*$day1);
    ?>
    <td><? echo(date('m-d', $d)); ?></td>
    <?
    }
    ?>
    </tr></table>
    [/CODE]

    Its very frustrating!

    Karl
    Last edited by pbmods; Oct 6 '07, 12:00 AM. Reason: Washed Karl's mouth out with soap.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi Karl.

    Try changing <? to <?php.

    The former is a the short (lazy) version and needs to be enabled in order to work. It is disabled by default.

    Edit:
    And of course I totally missed the JavaScript like 'var' in front of your variables. Remove them and all will be fine.
    Last edited by Atli; Oct 5 '07, 11:52 PM. Reason: Found the real reason

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Changed thread title to... ah, more accurately describe the problem.

      Comment

      • karlectomy
        New Member
        • Sep 2007
        • 64

        #4
        Hey atli,

        Thanks for the help. I figured it out before i read your post. It was the second thing. I've been programming in actionscript and got confused about variable declaration...

        And Pb... "I'm sick of these very frustrating snakes on this very frustrating plane!" - Samuel L. Jackson (as edited by PbMods) :P

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Originally posted by karlectomy
          And Pb... "I'm sick of these very frustrating snakes on this very frustrating plane!" - Samuel L. Jackson (as edited by PbMods) :P
          LOL!

          Very nice.

          Comment

          Working...