ryanthegecko Posted June 9, 2009 Share Posted June 9, 2009 HI there and an extra hello because this is my first post on this forum. I am going through a php-mysql book and have encountered some strange behaviour. As I am a total beginner, I expect this has some very simple solution. the line: echo "I'm glad we can use \"escape characters\" !<br />" ; on it's own in a page gives the correct result (the quotation marks appear in their rightful place) but when i first tried this line it was on the end of a page that I was doing some other tests/excercises on: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>I like Cheese!</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> </head> <body> <p>I like <?php $cheesse = "cheddar" ; echo "me n my brother watched Star Wars " ; echo $cheesse ; $cheesse ="stilton" ; ?> we also watched <?php echo $cheesse ; print "<br /><br /><h1>" ; $num = "cheese!" ; echo $num ; ?> <?php echo "This is a test. <br> "; echo "This is another test."; print "</h1>" ; ?> </p> The domain name for this document is: <script type="text/javascript"> document.write(document.domain); </script> <?php $sign = "Libra" ; $dates = "Sept 23 - Oct 22" ; echo <<<END Here is the Horoscope for $sign ; <table border="1" cellpadding="5" width="100%"> <tr> <td width="80">This week:<td> <td>With Mars in the ascendant you'll ecperience powerful cravings for chocolate some time around the 17th, but Mercury's influence(the "freddie effect") may restrain your urges - yo'll need to kee[ the weight off if you want to look good in spandex for that big gig! </td\> </tr> <tr> <td colspan="2">$sign: $dates</td> </tr> </table> END; $string1 = "concatenated strings " ; $string1 .= "are " ; $string1 .= "so much " ; $string1 .= "fun!<br />" ; echo $string1 ; $string1 ="abcdefghijklmnopqr" ; $string2 = substr($string1, 0, 3) ; $string2 .= substr($string1, 5, 9) ; echo $string2 echo "I'm glad we can use \"escape characters\" !<br />" ; ?> </body> </html> When I run this, I get an error report for line 76 (the last echo with the escape characters) when I cut out this line the page loads fine..... Why is this happening? Also, for anybody who may be responding, any tips on good forum practice would be appreciated eg is there a better way to present my question? or can I put my code in more clearly? Any advice truly appreciated! Ryan Link to comment https://forums.phpfreaks.com/topic/161490-solved-weird-escape-character-error/ Share on other sites More sharing options...
trq Posted June 9, 2009 Share Posted June 9, 2009 You are missing the closing ; on the line before the error. Link to comment https://forums.phpfreaks.com/topic/161490-solved-weird-escape-character-error/#findComment-852185 Share on other sites More sharing options...
ryanthegecko Posted June 9, 2009 Author Share Posted June 9, 2009 *smacks forehead* Thanks.. Link to comment https://forums.phpfreaks.com/topic/161490-solved-weird-escape-character-error/#findComment-852584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.