How to Parse error: syntax error, unexpected $end in . . .?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ann Madden
    New Member
    • Nov 2010
    • 6

    How to Parse error: syntax error, unexpected $end in . . .?

    Hello - I am super green to php and mysql. I have received the following error: Parse error: syntax error, unexpected $end in C:\website\char t.php on line 84... I have been through the code matching all of my {}, [], "", and '', and I can't find anything mis-matched. Also, there is no line 84. Any insights would be greatly appreciated. The code ia as follows:
    Code:
    <?php
    
      $conn = @new mysqli('localhost', 'root', 'bonkers1', 'prodtestdata');
    
      if (mysqli_connect_errno() != 0)
      {
        $errno = mysqli_connect_errno();
        $errmsg = mysqli_connect_error();
        echo "Connect Failed with: ($errno) $errmsg<br/>\n";
        exit;
      }
    
      $conn->query("SET NAMES 'utf8'");
    
      // prepare the query 
      $query_str = "SELECT * FROM prodtestdata";
      $result = $conn->query($query_str);
      if ($result === FALSE)
      {
        $errno = $conn->errno;
        $errmsg = $conn->error;
        echo "Connect Failed with: ($errno) $errmsg<br/>\n";
        $conn->close();
        exit;
      } 
      else
      {
        echo <<<EOM
      <table>
      <tr>
        <td>Product Name</td>
        <td>Product Size</td>
        <td>Structural Rating</td>
        <td>Air Rating</td>
        <td>Water Rating</td>
        <td>U-Factor</td>
        <td>SHGC</td>
        <td>VT</td>
      </tr>
    EOM;
    
        // get the data
        while (($row_data = @$result->fetch_assoc()) !==NULL)
        {
          echo <<<EOM
        <tr>
          <td>{$row_data['prod_name']}</td>
          <td>{$row_data['prod_size']}</td>
          <td>{$row_data['aama_rate']}</td>
          <td>{$row_data['air_rate']}</td>
          <td>{$row_data['water_rate']}</td>
          <td>{$row_data['u_rate']}</td>
          <td>{$row_data['shgc_rate']}</td>
          <td>{$row_data['vt_rate']}</td>
        </tr>
    
      EOM;
        }
    
        echo <<<EOTABLE
      </table>
    
    EOTABLE;
        //
        // clean up results
        //
        $result->close();
      }
      //
      // clean up connection
      //
      $conn->close();
    
    ?>
    Much Thanks,
    Ann
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    line #57: Heredoc closing delimiter must start at the beginning of the line.

    Comment

    • Ann Madden
      New Member
      • Nov 2010
      • 6

      #3
      Well I'll be - I would have never found that - works just fine now - thank you so much! Have a great weekend!

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        thanks. well, I wouldn’t know myself had I not have had such problems myself.

        Comment

        Working...