Page 1 of 1

Help in arranging quotation marks:D

Posted: Fri Sep 02, 2011 12:58 am
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.

Re: Help in arranging quotation marks:D

Posted: Fri Sep 02, 2011 2:21 am
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'>";

Re: Help in arranging quotation marks:D

Posted: Fri Sep 02, 2011 6:36 am
by truce enough
Thanks a lot! its is finally solved!!