Page 1 of 1

Unexpected "=" - why? what to do?

Posted: Sat Jan 15, 2011 3:39 pm
by abrogard
I get this error message:

Parse error: parse error, unexpected '=' in c:\Inetpub\wwwroot\xyford\manual\mybook.php on line 46

And here's line 46. The "=" causing the trouble is, I think, the "chapter=" one.

if ($prevPage > $chapters[$chapter][0]) $out .= "<a href="/mybook.php?chapter={$chapter}&page={$prevPage}">Prev</a>";

I can't see what to do about it.

Can anyone help?

Re: Unexpected "=" - why? what to do?

Posted: Sat Jan 15, 2011 3:56 pm
by McInfo
abrogard wrote:

Code: Select all

if ($prevPage > $chapters[$chapter][0]) $out .= "<a href="/mybook.php?chapter={$chapter}&page={$prevPage}">Prev</a>";
Quotes in strings must be escaped. Otherwise, they prematurely terminate the string.

Code: Select all

if ($prevPage > $chapters[$chapter][0]) $out .= "<a href=\"/mybook.php?chapter={$chapter}&page={$prevPage}\">Prev</a>";