suttercain Posted February 7, 2007 Share Posted February 7, 2007 Hi everyone, I am new(er) to PHP but I am trying to learn. I obtained about 10 books on the subject and am in Chapter 5 of the first one. I copied this script from the book <?php print "<table border="1">\n"; for ( $y=1; $y<=12; $y++ ) { print "<tr>\n"; for ( $x=1; $x<=12; $x++ ) { print "\t<td>"; print ($x*$y); print "</td>\n"; } print "</tr>\n"; } print "</table>"; ?> When I tried it out I got the following error: Parse error: syntax error, unexpected T_LNUMBER in /home/superman/public_html/test.php on line 7 I looked in the book to make sure I copied the code correctly and I did. Can someone point me to the error? I am here to learn so let me have it. Also... Can anyone recommend any really good PHP books for beginners that are easy to understand? Thank you in advance. Shannon Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 7, 2007 Share Posted February 7, 2007 print "<table border="1">\n"; You have " inside your string which aren't escaped. print "<table border=\"1\">\n"; Or print '<table border="1">'."\n"; Quote Link to comment Share on other sites More sharing options...
suttercain Posted February 7, 2007 Author Share Posted February 7, 2007 Thank you Jesirose, That worked. The code in "Sams Teach Yourself PHP 4 in 24 Hours" has a mistake on page 85. Shannon Quote Link to comment 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.