Help in arranging quotation marks:D

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
truce enough
Forum Newbie
Posts: 8
Joined: Fri Sep 02, 2011 12:53 am

Help in arranging quotation marks:D

Post by truce enough »

Can someone help me to arrange the quotation marks cause i got the error,
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'

echo "<tr class='d0' onmouseover='Changecolor(this, true);
' onmouseout='ChangeColor(this, false);
' onclick='DoNav(""view_place1.php?id=".$row['id'].""; ");
' style='cursor:pointer'>";

Thanks in advance.
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Re: Help in arranging quotation marks:D

Post by ok »

First of all, please use php code tags.

If you want to put quotation marks in string that is enclosed with quotation marks you need to escape them by \, meaning:

Code: Select all

echo "<tr class='d0' onmouseover='Changecolor(this, true);' onmouseout='ChangeColor(this, false);' onclick='DoNav(\"view_place1.php?id= " . $row['id'] . "\");' style='cursor:pointer'>";
Please read the PHP manual for further details:
http://php.net/manual/en/language.types.string.php

If you want to make the string easier to read, you can split it with a dot:

Code: Select all

echo "<tr class='d0' onmouseover='Changecolor(this, true);'" .
       " onmouseout='ChangeColor(this, false);'" .
       " onclick='DoNav(\"view_place1.php?id= " . $row['id'] . "\");'" .
       " style='cursor:pointer'>";
truce enough
Forum Newbie
Posts: 8
Joined: Fri Sep 02, 2011 12:53 am

Re: Help in arranging quotation marks:D

Post by truce enough »

Thanks a lot! its is finally solved!!
Post Reply