Forum Moderators: coopster

Message Too Old, No Replies

Problem with cancatenation operators

         

dbarasuk

11:36 pm on Dec 13, 2007 (gmt 0)

10+ Year Member



Hi!

I am having an unusual problem with strings. Can anybody experienced with strings tell me where resides the error in the next echo command, please?

echo "<p>".substr($row['content'], 0, $lastSpace)."(<a href='article.php?article_id=<?php echo $row['article_id'];?>'>Read More </a></p>)";

the error type i get while running the page containing that code is:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\htdocs\Darius\includes\home_format_admin.php on line 45

the line 45 indicated is the one on which the previous echo command is.

Any suggestion?

dreamcatcher

12:52 am on Dec 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

The problem is you have php tags in your echo. Should be:

echo "<p>".substr($row['content'], 0, $lastSpace)."(<a href='article.php?article_id=".$row['article_id']."'>Read More </a></p>)";

dc