Steven
Steven

Reputation: 25304

<br /> <b>Parse error</b>: syntax error, unexpected $end in <b>E:\xampp\htdocs\online\viewhistory.php</b> on line <b>43</b><br />

Below is the code of viewhistory.php.

    <?php
    foreach($_POST as $value){
     if (empty($value))
     {  echo 1;
      exit();

     }
    }
    //come code;
   //SQL query;
    while($row=mysql_fetch_assoc($result))
    {
     //some code;
      if (!empty($reference))
     {
     $referencetxt=<<<html
    |  Referenced Solution ID:$reference
    html;
     }
     else {
     $referencetxt=" "; 
     }
    $item+=<<<htm
    <hr>
    <span>Solution ID:$productid  $referencetxt</span>
    <xmp>$text</xmp>
    <img src=$imagepath />
    <div align="right">$username $moment</div>
    htm; 
    }
    echo $item;
    ?>

However, I get an error

<br />
<b>Parse error</b>:  syntax error, unexpected $end in

E:\xampp\htdocs\online\viewhistory.php on line 43

when I run it. What is wrong? Is a half bracket missing? But It seems all brackets are paired.

Upvotes: 0

Views: 8272

Answers (2)

prodigitalson
prodigitalson

Reputation: 60403

I dont think this is the issue but $item+=<<<htm should be $item.=<<<htm.

Upvotes: 0

Asaph
Asaph

Reputation: 162831

You've got trailing whitespace after htm; on line 43. Remove it and the parse error will go away.

Also, It looks like you're trying to concatenate the string created in the htm heredoc using the += operator. That should probably be changed to .=.

Upvotes: 4

Related Questions