I keep getting the following error in my log
PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'
The error is related to this line but I’m not sure what’s wrong with it
<?php
if ($num != null) {
$query_string = 'msisdn=' . $num . '&ref=' . get_post_meta($post->ID, "ref", $single = true) ;
echo '<div class="highlight"><a href="http://www.site.com/exJoin?signup=y&' . htmlentities($query_string) . '"><b>Join Now</b></a></div>';
}
else{
echo '<div class="highlight"><a href="<?php echo TeraWurflHelper::getPhoneHref('+2711111111'); ?>"><b>Join Now</b></a></div>';
}
?>
Try this:
Your problem was that you had a
<?php echo... ?>in the middle of a string that was already beingechoed. This had a'in it, which was the type of quote used to encapsulate the string that was already beingechoed. You could escape it (like\') but this would have your resulted in<?php echo... ?>beingechoed into your HTML, which I doubt is what you want, instead your should remove this and put the function call into the middle of your echo.This should be easy spot if you are using an editor/IDE with syntax highlighting. If your are not, look at EditPad, Notepad++ (editors) or Eclipse (IDE). Or Google it…