Errata
The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update
Version | Location | Description | Submitted by | Date submitted |
---|---|---|---|---|
Other Digital Version | 25 3rd paragraph |
The paragraph says "If there is any PHP code in a web page, it's a good idea to name the file on the web server with .php, not .html". Actually, it is usually required to name it .php to tell the server to parse a script. .html pages will mostly not get parsed and will return the source code of the php script instead. |
Anonymous | Mar 21, 2009 |
Printed | Page 26 1st paragraph |
The first sentence of the first paragraph on page 26 (2009 edition) uses 'are' before and after an 'also' making it a little confusing to read at first. |
Don Norman | Jan 29, 2011 |
Page 35, 36 Code lines referring to alien_description |
Reference on p. 36, 3rd line of php code is presented as the correct form field name, but is missing underscore between "alien" and "description" that is present in every other instance across these 2 pages. |
Peter McDonald | Apr 18, 2009 | |
Printed | Page 36 Solution explanation |
The arrow between the text block containing "The name of the form field in report.html is..." and the called out portion of code occludes some of the text in the aforementioned text block. |
Dave Solomon | May 31, 2011 |
Page 41 echo code |
Inconsistent form field names between pages using underscores between names here but on previous pages like p. 40 there are no underscores, i.e. "what_they_did" vs. "whattheydid" |
Peter McDonald | Apr 19, 2009 | |
Printed | Page 50 The caption for the bracket under "'From:' . $email" halfway down the page |
The caption says: |
StickyJr | Sep 03, 2011 |
64 SQL code on lower half of page |
As with the PHP script previously noted, the SQL code on this page do not copy and paste into text editors properly (tried two). |
Erich Riesenberg | Jun 10, 2010 | |
Printed | Page 67 Bubble Box next to 'sally@gregs-list.net' |
In the the bubble next to sally@gregs-list.net it says that a SQL statements does not end in a semicolon when used in PHP code. However, in the PHP code in the example that follows, the $query variable that is assigned from the INSERT INTO statement ends in a semicolon. Also, when entering the code into the MYSQL terminal, the semicolon is also required. I was confused by the bubble box statement. |
Jonathan | Dec 02, 2011 |
Printed | Page 88 Chapter 2 |
The fourth point on the bullet points list contains a reference to the function mysqi_query(). The correct spelling is mysqli_query() |
Maristella | Oct 15, 2009 |
Printed | Page 128 Near the bottom |
The statement: |
XJupiter | Sep 30, 2009 |
Printed | Page 136 email_list graphic |
The arrows connecting the queries to the $row buckets pass behind the email_list graphic with the exception of the last arrow, which passes over the graphic. It seems like it was meant to be behind like the others but the layer order get mixed up. |
Dave Solomon | Jun 06, 2011 |
Printed | Page 152 php code |
OK, I'm an ultimate newbie and have very little idea of what I'm doing...which is why I picked up this book. So far, I'm working through the examples, but I'm far from confident with what I'm doing.:-) |
Anonymous | Nov 27, 2009 |
Printed | Page 152 3th line of the php code |
<?php |
epic tree climber | Jan 30, 2010 |
Page 152 Bottom |
The Query for the Delete clase in the book: |
Anonymous | Oct 23, 2010 | |
Printed | Page 171 2nd IF statement |
The text indicates that we want to require input to both the subject and the text fields. The 2nd IF statement only outputs an error message if both fields are blank. The IF statement should use an OR, not an AND. |
DJPJ | May 28, 2009 |
Printed | Page 171 Validation logic statements |
$_POST['elvismail'] is assigned to the variable $text, but the validation logic statements use the variable $body. |
lemuel | Jun 01, 2009 |
Printed | Page 171 full page |
The name of the email body variable is inconsistent. At the top of the page and in the problem solution, it's referred to as $text, but in the logic examples it's referred to as $body. |
Carl Jonard | Jul 13, 2009 |
Printed | Page 171 3rd and 4th paragraphs |
There are two errors on this page: |
XJupiter | Sep 30, 2009 |
Printed | Page 172 sharpen your pencil |
Continuation of the same problem on page 171. If you use the logic in the book as is, then if subject is blank and text is filled in, no email will be sent and no error message will be given. Same thing if subject is filled in and the text field is blank. |
DJPJ | May 28, 2009 |
Printed | Page 173-174 Sharpen your pencil |
The same logic error as on 171 and 172. |
DJPJ | May 28, 2009 |
Printed | Page 179 third and fourth code snippets |
the third and fourth code snippets read |
Maristella | Oct 21, 2009 |
Printed | Page 186 Underneath "// We know both $subject AND $text are blank" |
You are missing the echo statement below the following statement: |
XJupiter | Sep 30, 2009 |
Printed | Page 188 5th coding line |
The Author is missing one right parenthesis on the 5th coding line. |
XJupiter | Sep 30, 2009 |
Printed | Page 190 5th coding line |
The Author is missing one right parenthesis on the 5th coding line. |
XJupiter | Sep 30, 2009 |
Printed | Page 202 Last sentence in "Check to see if the form has been submitted" section |
"Just make sure the 'submit' matches up with the id attribute of the Submit button in the form code." should say "Just make sure the 'submit' matches up with the name attribute of the Submit button in the form code." |
DJPJ | May 28, 2009 |
Printed | Page 203 Top right of page (the comment) |
The first line of the comment is incorrect: |
XJupiter | Sep 30, 2009 |
Printed | Page 204 Modified form code |
Code as written results in "undefined variable" errors for both $subject and $text the first time the script is run. Setting both variables to null before checking for $_POST['submit'] is one solution: |
lemuel | Jun 01, 2009 |
Printed | Page 204 sample code at bottom of page |
Sample code's textarea tag is indented <?php echo $text; ?> on next line, but doing so caused whitespace to be inserted in form's textarea on initial page load. If no body text is entered in the form, the spaces in the textarea still cause the $text variable to be "not empty" and the email is able to be sent despite the user not having entered any text there. |
Anonymous | Jul 22, 2009 |
Printed | Page 204 chapter 4, final code |
The code that is missing something is in the book within chapter 4, when the authors are showing how to put all the code into the into the sendemail.php. |
Anonymous | Jan 28, 2011 |
Printed | Page 211 ALTER TABLE statement |
FYI .... I'm running MySQL 5.1.34, and the syntax that worked is: |
DJPJ | May 28, 2009 |
Printed | Page 216 both code snippets |
German translation, 1st edition, 2009. |
Sebastian Pohl | Aug 28, 2012 |
Printed | Page 227 Left Center Comment |
The comment: |
XJupiter | Sep 30, 2009 |
Printed | Page 235 mysql command line screen shot |
sql statement is incorrect uses DESCRIBE email_list; should be DESCRIBE guitarwars; |
Anonymous | Apr 11, 2009 |
Printed | Page 235 Test Drive |
Before creating the table, you have to either create a new database, or decide to add the table to an existing database. Then you have to issue the USE statement; then you can run the CREATE TABLE and INSERT statements. |
DJPJ | May 29, 2009 |
Printed | Page 236 First sentence |
"With a new column added to the high score database,"?? The database is named "gwdb" and the table is named "guitarwars." I think it should say "With a new column added to the guitarwars table," |
DJPJ | May 29, 2009 |
Printed | Page 242 IF statemetn |
filesize($row["screenshot'] should be filesize($row['screenshot'] |
DJPJ | Jun 01, 2009 |
Printed | Page 242 Near bottom of the page |
The following line of code is incorrect: |
XJupiter | Sep 30, 2009 |
245 First Paragraph |
Maybe this is clarified later on the text, but it says: |
David Friedman | Aug 23, 2009 | |
Printed | Page 251 addscore.php code lines with move_uploaded_file |
It almost seems like a page is missing from the book, because it never actually shows you entering in code for a line that includes move_uploaded_file onto the addscore.php, (which makes this whole area confusing) but on page 251, it is there already inserted, while discussing the creation and integration of the GW_UPLOADPATH. |
Jeff | Feb 26, 2009 |
Printed | Page 252 answer to making file names unique with adding time() |
Adding the time() function to the $target variable will not work for the web site because it causes the name in the database to be different than the name of the actual picture file that is being saved in the images folder. The time function should be added to the |
Jeff | Feb 26, 2009 |
Printed | Page 267 Top right comment |
This line: |
XJupiter | Sep 30, 2009 |
268 top |
The description asks for less than the GW_MAXFILESIZE however the code is implemented as less than or equal to GW_MAXFILESIZE. |
David Friedman | Nov 11, 2009 | |
268 top |
At least on my system png images were identified by the mime type image/x-png |
David Friedman | Apr 19, 2010 | |
Printed | Page 268 "Sharpen your pencil solution" box at top of page |
This might be the authors using "tough love" to get readers to think for themselves, or it might be an oversight, but in the "Sharpen your pencil" solution box on p. 268 of the printed book, the answer includes two new variables and the text says "Assume the file size and type have already been stored in variables named $screenshot_size and $screenshot type." |
Mike | May 10, 2010 |
Printed | Page 269 code sample |
Looks like we are testing for 4 error conditions, but only displaying a message for 3 of them. |
DJPJ | Jun 01, 2009 |
Printed | Page 269 Coding near the bottom |
The following line: |
XJupiter | Sep 30, 2009 |
Printed | Page 276 First paragraph. |
The third sentence of paragraph begins "This begs the question, how does the Admin script" et cet. This is incorrect usage. "Begging the question" is a logical fallacy wherein one assumes as a premise of an argument exactly that which the argument purports to prove. |
Thomas Kennedy | Aug 16, 2010 |
301 |
Passwords should always be encyrpted becosue pepole don't use diffrent passwords on separate sites. On page 301 it gives the developers the idea that passwrods should at any time be unencrypted. This is not a good idea becosue pepole use their password in more places then one. |
Kyle | Aug 18, 2010 | |
Printed | Page 322 ALTER statement |
In my version of MySQL (5.1.34) adding the column 'approved' as TINYINT sets the value to NULL in all existing rows. |
DJPJ | Jun 02, 2009 |
Printed | Page 324 Sharpen Your Pencil Solution |
Since we created the Approved field as integer rather than a string, there should not be single quotes around $id in the UPDATE query. |
lemuel | Jun 17, 2011 |
Printed | Page 326 Sharpen your Pencil solution |
if ( $row['approved'] == '0') should probably be |
DJPJ | Jun 02, 2009 |
335 bottom right hand corner |
I'm not sure I understand what the text means in this passage: |
David Friedman | May 06, 2010 | |
Printed | Page 336 lower half |
Instructions to add "mysqli_real_escape_string" to variables is incomplete; the parameters include the database connection in the form of the variable "$dbc", but the script won't work because that variable is not set until later in the script. The line of script setting the variable and connecting to the database must be moved up in the script. |
Mike | May 14, 2010 |
Printed | Page 339 Last paragraph /"Exercise" section |
isnumeric should be is_numeric |
Cathy Austin | Oct 20, 2009 |
361 3rd grayed part of the code |
in the line of code: |
Sherif Mahmoud | May 24, 2009 | |
Printed | Page 361 Code example of login.php, first two lines |
The login.php code starts with getting an include file: |
Jonathan Richards | Feb 20, 2015 |
Printed | Page 371 |
When conducting the "Test Drive" and adding a image i was getting an error stating "Notice: Undefined index: file ...editprofile.php line 60" |
jr_holland28 | May 17, 2009 |
Printed | Page 380 in the code |
Error message is returned for: |
happynewton | Oct 18, 2010 |
Printed | Page 399 First code example image |
On page 379 the illustration caption on the lower right of the page indicates that the index page will show the latest member names as links instead of static text if the user is logged in. However, there are never instructions in the book to make this change to the index page code or to download and use the later version of the page from the Head First site. |
Mike | May 17, 2010 |
Printed | Page 403 Main Paragraph |
There is a description of the php.ini setting "session.use_trans_id", which should be "session.use_trans_sid", according to the php manual. |
lemuel | Jun 12, 2009 |
Printed | Page 403 middle of the paragraph |
Here they talk about "session.use_trans_id". However, it should be "session.use_trans_sid". Small typo. |
David Tang | Jun 14, 2009 |
416 Top |
To check if a user is logged in is it better to use isset($_COOKIE['user_id']) or empty($_COOKIE['user_id']) ? |
David Friedman | May 13, 2010 | |
443 Lower part |
It looks like there are some discrepancies between the database as defined by the SQL statements downloaded from the website, and the screenshots of the output of the DESCRIBE statements. |
David Friedman | May 17, 2010 | |
443 Download Link |
In the script which generates the mismatch_topic table it looks like there are some typos in category labels: |
David Friedman | May 18, 2010 | |
Printed | Page 447 Second SELECT query of PHP & MySQL Magnets on line 6 |
The $query in the book and in the download code is: "SELECT topic_id FROM mismatch_topic ORDER BY category_id, topic_id" |
Rich dev | Feb 15, 2009 |
448 Center |
$query = "INSERT INTO mismatch_response (user_id, topic_id) VALUES ('" . $_SESSION['user_id'] . "' , '$topic_id' )" ; |
David Friedman | May 18, 2010 | |
Printed | Page 456 Code section marked with 1 |
The query shows: |
Jim Munro | May 08, 2009 |
Printed | Page 456 In the code, Second"$query" |
$query is set to equal "SLECT * FROM mistmatch_response ORDER BY category_it, topic_id". |
Anonymous | Jun 04, 2009 |
Printed | Page 456 In section of code labeled #1 |
the second query reads "SELECT topic_id FROM mismatch_topic ORDER BY category_id, topic_id"; |
Anonymous | Jan 20, 2010 |
Other Digital Version | 457 in the example code, not in the book I don't think |
In the downloaded code of chapter 7.5 I got an error when submitting my profile picture. |
Jim Munro | May 08, 2009 |
Other Digital Version | 458 Test Drive |
Hello: |
Anonymous | Nov 29, 2009 |
Printed | Page 476 Top of page, first "A"nswer |
The text says: |
Robert Kulagowski | May 13, 2011 |
Printed | Page 492 United States |
On page 492, "The text response('2' for example) is cast to an integer(2) so that it can be added and compared. In both the code supplied for page 493 and the final code, the int() cast is missing: |
Mike Griffin | Sep 28, 2011 |
PDF, ePub | Page 492 for loop in the page |
The code in this page and the downloaded file does not work correctly unless you also check in the "for" loop if the variable |
Renato Fiuza | Dec 12, 2013 |
Printed | Page 493 in code somewhere... |
When I uploaded your code to find my errors, it worked fine, except for the link to the user's profile at the bottom of the page. It displayed my user profile rather than the mismatched user profile. |
Heidi Daley | Mar 09, 2010 |
Printed | Page 493 United States |
It doesn't matter if you use the "final" code as distributed or you add the (int) cast as shown in the book, when you try to open mymismatch.php, the |
Mike Griffin | Sep 28, 2011 |
Printed | Page 493 United States |
The undefined offset error running this code really bugged me. So I did a lot of searching. It appears that this may be badly written code for the book. I found several posts where other books used code that produced the same error..Here's the quote: |
Mike Griffin | Sep 28, 2011 |
Other Digital Version | 506 Downloadable SQL Database |
The database does not import properly as it is on the server: entry number 12, Pet Food Tester, has the following description: |
Laurel Raven | Aug 14, 2009 |
Other Digital Version | 506 At end of the page |
The .sql file given in the source for chapter 9 is not importing. please give a valid .sql file. |
Seraphimus Phoenix | Sep 07, 2012 |
Printed | Page 508 Solution for "LIKE '%ma'" |
In the magnet exercise solution, it only shows "Human Cannonball" and "Team Mascot" being a match for LIKE '%ma%'; however, since the LIKE term is case insensitive and % matches on anything INCLUDING nothing, it should also list "Matador" as a match. |
Laurel Raven | Aug 14, 2009 |
508 Magnets for 'c%' |
It looks like one of the magnets is missing for 'c%' (the magnet for Crash Test Dummy) |
David Friedman | May 20, 2010 | |
Printed | Page 509 Speach/Thought Bubble at top |
Poor wording choice: |
Laurel Raven | Aug 14, 2009 |
Printed | Page 515 1st paragraph |
Test Drive Download - "The search.php script contains the query generation code you just worked through..." |
Head First Gunieau Pig | Apr 15, 2010 |
523 Center |
SELECT * FROM riskyjobs |
David Friedman | May 20, 2010 | |
Printed | Page 530 Sharpen your PEncil |
The comment in that section states that the data is in MM-DD-YYYY format, but it's not. It's YYYY-MM-DD. |
Robert Kulagowski | May 16, 2011 |
534 first query and fourth query |
In the queries the actual column name created by the script is "title" yet in the answers it is written as "job_title". |
David Friedman | May 21, 2010 | |
Printed | Page 544 Exercise Solution |
I couldn't bring myself to put all that redundant code in my script. |
DJPJ | Aug 28, 2009 |
Printed | Page 546 Test Drive |
When I take the test drive, I get an error "Notice: Undefined index: sort in C:\Inetpub\wwwroot\hfphp\ch09\riskyjobs\search.php on line 109. |
DJPJ | Aug 28, 2009 |
Printed | Page 546 Test Drive |
that should appear as $sort = ''; not $sort = ";" |
DJPJ | Aug 28, 2009 |
Printed | Page 549 Bottom paragraph, last sentence, above queries |
The last sentence of the paragraph states "For example, here's how you get rows 11 through 25, which would be the third page of results." It should be 11 through 15 as the query is only set to return 5 results beginning at 11. |
Anonymous | Mar 03, 2009 |
Printed | Page 549 3rd paragraph (last). |
The last line of the page says, "For example, here's how you get rows 11 through 25, which would be the third page of the results:". The '25' should be replaced with a '15'. |
Waleed Khan | May 19, 2011 |
Printed | Page 550 1st paragraph |
The book reads: |
Maristella | Nov 28, 2009 |
Printed | Page 552 Code example and downloadable code for chapter |
Hi, me again. |
Jim Munro | May 11, 2009 |
556 Links for next and previous |
When you do a less than sign or greater than sign in HTML it should probably be done with > or < rather than the direct symbol since the '>' is used to do the markup. |
David Friedman | May 24, 2010 | |
Printed | Page 577 (min,max) box |
I think the last sentence should be removed ... "Here we're saying it should appear 2, 3, or 4 times in a row." |
DJPJ | Aug 28, 2009 |
578 Bottom (description of the exercise) |
Write a regular expression that matches international phone numbers: |
David Friedman | May 27, 2010 | |
Printed | Page 582 Regular expression |
On page 582 is a regex made and used in the further pages, it contains an error... |
Anonymous | Feb 12, 2013 |
Printed | Page 587 Downloaded Source Code |
Similar to error on 552. The registration form attempts to pre-populate the input fields with variables based on the $_POST data. The first time the script is run these variables do not exist and each field shows a php "Undefined variable" error. |
lemuel | Jul 08, 2009 |
Printed | Page 596 Sample regex, bottom half of page |
In the sample regex, the question mark is not escaped. According to the text on page 580 a question mark must be escaped because it is a reserved character. |
Mike | May 23, 2010 |
Printed | Page 596 sample regex in bottom half of page |
Upon further investigation it's looking like escaping rules are not exactly the same inside character sets. When I used that regex in the registration script without escaping the hyphen, I got a warning about it. When I escaped it, the warning did not occur. |
Mike | May 23, 2010 |
602 top of the page in preg_match() call |
I think we need to add a caret to the beginning of the regular expression which checks for the valid local part of the email address. |
David Friedman | May 31, 2010 | |
Printed | Page 604 top right post-it |
The post-it box describes some REGEX metacharacters and references a whitespace metacharacter with '\w'. |
Mitch Lowther | May 21, 2013 |
Printed | Page 614 imagettftext function |
The parameter with the font name some times should be writed with a absolute path, depending on your GD library version. |
Douglas Oliveira | Apr 10, 2020 |
Printed | Page 618 middle of page |
The description of the imagefilledellipse points to parameters 2 and 3 as width and height, and parameters 4 and 5 as x and y coordinates. It seems as though they are reversed. Parameters 2 and 3 should represent the x and y coordinates and parameters 4 and 5 should represent the width and height. |
tmichael | Mar 20, 2009 |
Page 623 41th line of code |
When you start captcha.php on the linux server generated picture, but without the text. |
Anonymous | Jul 31, 2013 | |
634 center |
Seems that we also need the response field in order to see whether there is a mismatch. |
David Friedman | Jun 02, 2010 | |
634 Center |
With respect to my above question: |
David Friedman | Jun 02, 2010 | |
Printed | Page 641 Exercise, bottom half of page |
The exercise creates a two-dimensional array populated with the data from the array $mismatch_categories. But the instructions up to this point never create an array called $mismatch_categories. It appears as a line in the downloadable file for page 646 (in the folder ch11) in the downloads. It is line 111: |
Mike | May 25, 2010 |
Printed | Page 674 By #4, the query statement and by #5 the link tag |
This page is a listing for newsfeed.php. The lines in question are: |
Ed | Sep 07, 2012 |
Printed | Page 674 By #4, the query statement and by #5 the link tag |
When did the data type for when_it_happened changed? |
Ed | Sep 07, 2012 |
Printed | Page 675 Downloaded Source Code |
Line 49 of index.php has $row[last_name], should be $row['last_name']. |
lemuel | Jul 14, 2009 |
Printed | Page 677 Top |
When did we create an index.php for Aliens Abducted Me? |
Edward | Sep 12, 2012 |
694 bottom |
The text says that the yt namespace is used solely with the statistics tag, yet it seems that it is used also in other places. |
David Friedman | Jun 10, 2010 | |
Printed | Page 715 7th row, columns 2 and 3 |
The printed version correctly states how to execute a MySQL query. In other words, the errata stating that the printed version is in error is incorrect (i.e. the errata is wrong). |
Anonymous | Feb 01, 2010 |
Printed | Page 733, 737 page 733, top of page 737 |
Also, the version of PHP is now 5.3.6 and the installer no longer displays the long list of servers to configure - as shown on page 737. |
Anonymous | Aug 24, 2011 |
Printed | Page 734 2nd paragraph |
The book reads "To determine if you have MySQL on the Mac, open your terminal and type: cd /user/local/mysql |
Anonymous | Nov 10, 2009 |
738 the link just above the last paragraph |
It says to get version 6.0 or newer. The MySQL documentation page says, "Note: The MySQL 6.0 Reference Manual has been retired. MySQL 6.0 was not developed beyond Alpha status and new releases have not been made for some time, so the manual has been withdrawn as well." |
kajaco2 | Oct 08, 2009 | |
Printed | Page 751 1st paragraph |
The book suggests to go to the www.libgd.org website to obtain the php_gd2.dll file. It seems that this is no longer the case or there is now an easier method. |
Hans Prorok | Apr 05, 2010 |