Parse error: syntax error, unexpected $end in "xxx line no 103"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bandula
    New Member
    • Sep 2007
    • 1

    Parse error: syntax error, unexpected $end in "xxx line no 103"

    Code given below
    [CODE=php]
    echo <<
    <style type="text/css">
    table, tr, td, th, tbody, TR, TD{
    font-family: Verdana;
    font-size: 8pt;
    font-size: 11;
    color: #000000;
    border-font-size: 11;
    color: #000000;
    border-collapse: collapse;
    }
    </style>
    <table border="l" cellpadding="l" width="98%">
    <tr>
    <td align="center" colspan="7" bgcolor="#99999 9"> $Current_Day_Na me,$Current_Mon th_Name, $Current_Year
    </tr>
    <tr>

    $Day_Names
    </tr>
    <tr>
    $Cal_Weeks_Days
    <tr>
    </table>
    HTML;
    ?> (line no 103)[/CODE]
    Last edited by ak1dnar; Sep 13 '07, 05:32 AM. Reason: Added CODE tags
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Hi bandula, check this out.

    [CODE=php]$php_data_goes_ here='Some_php_ out_put';
    echo 'HTML_DATA_GOES _HERE '.$php_data_goe s_here.' AND_ANOTHER_HTM L';
    echo '<br>';
    echo "YOUR HTML DATA AND $php_data_goes_ here";[/CODE]

    Please use the code tags when posting source codes in this format.
    &#91;code=ph p]
    your php code goes here
    [/code]

    Comment

    • JeremyMiller
      New Member
      • Sep 2007
      • 69

      #3
      Your first line should be

      [code=php]
      echo <<<HTML
      [/code]

      Comment

      • Weisbartb
        New Member
        • Aug 2007
        • 36

        #4
        For the love of god please don't use heredocs. If you insist on it please read the php doc on it.

        Comment

        • JeremyMiller
          New Member
          • Sep 2007
          • 69

          #5
          What's so wrong with heredoc? It has its uses. Biggest issue is modifying code later on and realizing that you're in heredoc.

          Comment

          • ak1dnar
            Recognized Expert Top Contributor
            • Jan 2007
            • 1584

            #6
            Any variables within heredoc will be parsed as PHP handles double quotation marks.but when you closing it do not use any spaces or other characters on it. in other words;

            [CODE=php]<?php
            $some_var = 'String2';
            echo <<<EOT
            String1 $some_var String3
            /* because of this error comes*/EOT;
            ?>
            [/CODE]

            Comment

            • ak1dnar
              Recognized Expert Top Contributor
              • Jan 2007
              • 1584

              #7
              Heya guys, I found something interesting with the forum text editor. I copied this to Wysiwyg editor:
              <?php
              $some_var = 'String2';
              echo <<<EOT
              String1 $some_var String3
              EOT;
              ?>
              And got this, after pressing CODE icon. See <EOT is missing
              [CODE=php]<?php
              $some_var = 'String2';
              echo <<
              String1 $some_var String3
              EOT;
              ?>[/CODE]

              So I think on the original post also, It has happened. (that was my fault, I am the one who add the CODE tags to the source codes)

              So Its better to hand code the [CODE] tags with out clicking the icons on the editor. :D

              Comment

              • Weisbartb
                New Member
                • Aug 2007
                • 36

                #8
                Originally posted by JeremyMiller
                What's so wrong with heredoc? It has its uses. Biggest issue is modifying code later on and realizing that you're in heredoc.
                Output control is key if your using headers or sessions. If you use a heredoc you have to generate all that stuff at the end and probably not in the most efficient manor.

                Comment

                Working...