title: HEREDOC Returning unexpected end
body: <p>The following snippet is causing an</p>
  
  <blockquote>
    <p>"PHP Parse error:  syntax error, unexpected $end in /Applications/MAMP/htdocs3/nettuts/PHP/PDO for Database Access/htdocs/view_users02.php on line 39"</p>
  </blockquote>
  
  <p>I've looked around the site and google but didn't find an exact solution.</p>
  
  <pre><code>  foreach($DBH-&gt;query($sql) as $row){
  
          $output = "&lt;tr&gt;&lt;td align='left'&gt;" . $row["name"] . "&lt;/td&gt;&lt;td align='left'&gt;" . $row["dr"] . "&lt;/td&gt;&lt;/tr&gt;";
  
  
              // echo '&lt;tr&gt;&lt;td align="left"&gt;' . $row['name'] . '&lt;/td&gt;&lt;td align="left"&gt;' . $row['dr'] . '&lt;/td&gt;&lt;/tr&gt;';
       echo &lt;&lt;&lt;EOT
              $output
      EOT;         
  </code></pre>
  
  <hr>
  
  <p><b>Complete Script</b></p>
  
  <pre><code>&lt;?php 
  $page_title = 'View the Current Users';
  include ('includes/header.html');
  
  // Page header:
  echo '&lt;h1&gt;Registered Users&lt;/h1&gt;';
  
  require_once ('../mysql_pdo_connect.php'); // Connect to the db.
  
  // Make the query:
  
  $sql = "SELECT CONCAT(last_name, ', ', first_name) AS name, DATE_FORMAT(registration_date, '%M %d, %Y') AS dr FROM users ORDER BY registration_date ASC";   
  
      // Table header.
      echo &lt;&lt;&lt;EOT
      &lt;table align='center' cellspacing='3' cellpadding='3' width='75%'&gt;
      &lt;tr&gt;&lt;td align='left'&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/td&gt;&lt;td align='left'&gt;&lt;b&gt;Date Registered&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
  EOT;
  
  
  foreach($DBH-&gt;query($sql) as $row){
  
      $output = "&lt;tr&gt;&lt;td align='left'&gt;" . $row["name"] . "&lt;/td&gt;&lt;td align='left'&gt;" . $row["dr"] . "&lt;/td&gt;&lt;/tr&gt;";
  
  
          // echo '&lt;tr&gt;&lt;td align="left"&gt;' . $row['name'] . '&lt;/td&gt;&lt;td align="left"&gt;' . $row['dr'] . '&lt;/td&gt;&lt;/tr&gt;';
   echo &lt;&lt;&lt;EOT
          $output
  EOT;         
  
          }
  
      echo '&lt;/table&gt;'; // Close the table.
      $DBH = null;
  
  
  include ('includes/footer.html');
  ?&gt;
  </code></pre>