I'm new at using PHP & I'm trying to read a book called PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide by Larry Ullman. I'm not sure what version it is seeing as how I have the pdf version, but anyways, I'm getting this error when I run my script:
Parse error: syntax error, unexpected '10' (T_LNUMBER) in C:\xampp\htdocs\IDE\comments.php on line 14
This is line 14 of my script:
echo '<p>This is a line of text.<br />This
is another line of text.</p>';
I assume you copied code that has line numbers and looks like this:
10 # Created August 27\, 2007 11
11 # Created by Larry E. Ullman 12
12 # This script does nothing much.
13
14 echo '<p>This is a line of text.<br />This is another line of text.</p>';
The line numbers are not part of the php and should not be copied. The code should like like so:
# Created August 27\, 2007 11
# Created by Larry E. Ullman 12
# This script does nothing much.
echo '<p>This is a line of text.<br />This is another line of text.</p>';
It seems that you copied and pasted line numbers as well as the code.
10,11,12,...
should not be at the front of the lines.
Your code should instead look like this:
# Created August 27, 2007
# Created by Larry E. Ullman
# This script does nothing much.
echo '<p>This is a line of text.<br />This is another line of text.</p>';
The reason this works is because a #
sign at the start of a line tells PHP that it is a comment and that it shouldn't read that line. Copy and paste is not such a good idea sometimes.