swampone Posted September 1, 2010 Share Posted September 1, 2010 Im getting a syntax error caused by the first line. How do I properly escape the code? echo "<tr class="'.$colors[$i++ % 2].'"> <td align=center nowrap>($phone1) XXX-$phone2</td> <td align=center nowrap>$overall</td> <td align=center nowrap>$hygiene</td> <td align=center nowrap>$attitude</td> <td align=center nowrap>$ethnicity</td> <td align=center nowrap>$body</td> <td align=center nowrap>$city</td> <td align=center nowrap>$user</td> <td align=center nowrap>$date</td> <td align=center nowrap>$comment</td> </tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/212283-escaping-properly/ Share on other sites More sharing options...
petroz Posted September 1, 2010 Share Posted September 1, 2010 This looks like the problem on the first line. echo "<tr class=".$colors[$i++ % 2]."> <td align=center nowrap>($phone1) XXX-$phone2</td> <td align=center nowrap>$overall</td> <td align=center nowrap>$hygiene</td> <td align=center nowrap>$attitude</td> <td align=center nowrap>$ethnicity</td> <td align=center nowrap>$body</td> <td align=center nowrap>$city</td> <td align=center nowrap>$user</td> <td align=center nowrap>$date</td> <td align=center nowrap>$comment</td> </tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/212283-escaping-properly/#findComment-1106095 Share on other sites More sharing options...
swampone Posted September 1, 2010 Author Share Posted September 1, 2010 I knew it was something simple. Thanks a bunch!!! Quote Link to comment https://forums.phpfreaks.com/topic/212283-escaping-properly/#findComment-1106099 Share on other sites More sharing options...
petroz Posted September 1, 2010 Share Posted September 1, 2010 I think your gonna need todo the same thing on each line.... Quote Link to comment https://forums.phpfreaks.com/topic/212283-escaping-properly/#findComment-1106103 Share on other sites More sharing options...
swampone Posted September 1, 2010 Author Share Posted September 1, 2010 Naw, the one line solved everything Quote Link to comment https://forums.phpfreaks.com/topic/212283-escaping-properly/#findComment-1106136 Share on other sites More sharing options...
petroz Posted September 1, 2010 Share Posted September 1, 2010 Great! Quote Link to comment https://forums.phpfreaks.com/topic/212283-escaping-properly/#findComment-1106137 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.