Errata for Head First PHP & MySQL
Submit your own errata for this product.
The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".
The following errata were submitted by our customers and approved as valid errors by the author or editor.
Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update
| Version |
Location |
Description |
Submitted By |
Date Submitted |
Date Corrected |
| Printed |
Page 24 29 30 33 35 36
all examples of variable $fang_spotted on these pages |
each code example of the variable $fang_spotted = $_POST['fangspotted'] doesn't end with a semi-colon
it is however mentioned earlier on in the example with a semi-colon on the end, and also in the downloadable code example.
Note from the Author or Editor: Each occurrence of the line of code $fang_spotted = $_POST['fangspotted'] on pages 24, 29, 30, 33, 35, and 36 is missing a semicolon at the end of the line. They should have a semicolon as follows:
$fang_spotted = $_POST['fangspotted'];
|
Matt Worthington |
Jan 15, 2009 |
Jun 01, 2009 |
| PDF |
Page 26
1st paragraph |
One extra "are" in the first sentence.
Note from the Author or Editor:
|
Peter McDonald |
Apr 18, 2009 |
Aug 26, 2011 |
| Printed |
Page 111
3rd paragraph |
the "t" is missing in "execute", the book reads "execue".
Note from the Author or Editor:
|
Maristella |
Oct 17, 2009 |
Aug 26, 2011 |
| Printed |
Page 125
first question of "there are no dumb questions" |
one "e" is missing in "statement", the book reads "statment".
Note from the Author or Editor:
|
Maristella |
Oct 18, 2009 |
Aug 26, 2011 |
| Printed |
Page 148
second 'sharpen your pencil' answer |
The answer to the second question should be "33". The problem states that there are 23 customers with a first name of Anne, and 11 customers with a last name of Parker.
Therefore the number of customers with a first name of Anne will already include 'Anne Parker', and the or clause will only bring in 10 more records, those Parkers whose first name is not 'Anne'.
Note from the Author or Editor: The second Sharpen Solution answer should be 33, not 34. The customer Anne Parker would already be counted in the 23 customers with a first name of Anne, and shouldn't be counted again in the 11 customers with a last name of Parker. So the total number of customers matching teh WHERE clause is 33, not 34.
|
Johny X |
Jan 16, 2009 |
Jun 01, 2009 |
| Printed |
Page 154
Graphics |
The file graphics cover up the file names below each graphic.
|
Dave Solomon |
Jun 06, 2011 |
Aug 26, 2011 |
| Safari Books Online |
189
End of Test Drive Description |
There's a question mark missing from the last sentence.
|
David Friedman |
Jul 23, 2009 |
Aug 26, 2011 |
| Printed |
Page 210
first paragraph |
the sentence "... only one *common* can be made the primary key" probably should be "... only one *column* can be made the primary key"
|
john |
Jan 21, 2009 |
Jun 01, 2009 |
| Printed |
Page 256-257
connectvars.php code |
The connection variables on pages 256-257 don't match up. So what is shown in connectvars.php on 256 for DB_PASSWORD and DB_NAME is different than what is shown as being included in index.php on 257.
Note from the Author or Editor: The DB_PASSWORD and DB_NAME connection vars should be the same on 256 and 257. The example code aligns with the values on 256 but the specific settings aren't critical in this case because these are purely hypothetical database connection examples. The main thing is that they should match up from 256 to 257.
|
sanders kleinfeld |
Dec 12, 2008 |
Jun 01, 2009 |
| Printed |
Page 269
top of code example |
if ($_FILES['file']['error'] == 0) {
should be
if ($_FILES['screenshot']['error'] == 0) {
|
Shaya |
Feb 01, 2009 |
Jun 01, 2009 |
| Printed |
Page 286-289
removescore.php code |
The screen shot image filename is not being sent along as part of the POST data, resulting in the screen shot image file on the server not being removed when a score is removed. The solution is to add a new hidden form field to the generated form using the following line of PHP code:
echo '<input type="hidden" name="screenshot" value="' . $screenshot . '" />';
And then initialize the $screenshot variable near the beginning of the script where the other POST data is being initialized. Use this line of PHP code:
$screenshot = $_POST['screenshot'];
|
 Michael Morrison
|
Jan 09, 2009 |
Jun 01, 2009 |
| Printed |
Page 326
sharpen your pencil code |
In this piece of code:
if ($row['approved'] == '0')
{
echo ' / <a href="approvescore.php?id=' . $row['id'] . '&date=' . $row['date'] .
'&name=' . $row['name'] . '&score=' . $row['score'] . '&screenshot=' .
$row['screenshot'] . THERE ARE DOUBLE QOUTES MISSING RIGHT HERE -----> '>Approve</a>';
It shouldbe '">Approve</a>';
Note from the Author or Editor: The last line of the Sharpen Solution code is missing a double quote in the portion of the code with the Approve link. The last line of code should read like this:
$row['screenshot'] . '">Approve</a>';
|
Benjamin Groeneweg |
Jan 18, 2009 |
Jun 01, 2009 |
| Printed |
Page 347
1st paragraph |
It says in the first paragraph: "A database called mismatch_user is used...", but the database isn't called like that, the table within the database is. The name of the database is Mismatch in the book, and in the downloadable code for the book it is mismatchdb.
Note from the Author or Editor: First paragraph, last sentence, "database" should be "table". So it should read:
"A table called mismatch_user is used to keep up with..."
|
Benjamin Groeneweg |
Jan 18, 2009 |
Jun 01, 2009 |
| Printed |
Page 436
Last paragraph |
"efficicient" should be "efficient".
|
Thomas Kennedy |
Aug 18, 2010 |
Aug 26, 2011 |
| Safari Books Online |
535
top of the page |
The phrase "it's possible construct a single query" changed to "it's possible to construct a single query".
|
David Friedman |
May 21, 2010 |
Aug 26, 2011 |
| Printed |
Page 544
first paragraph |
'sarch' should be 'search'
|
DJPJ |
Aug 28, 2009 |
Aug 26, 2011 |
| Printed |
Page 544
case 3: third blank to be filled |
This is probably just a typo, but the written in answer on the third line I believe should be 5, not 3. The data location being accessed does not mention a date as it should, but the state.
Note from the Author or Editor: Under the second case statement (case 3:), the third link generated should have an answer of 5, not 3. This is because this link is to sort by date, which is controlled in the code by the values 5 (ascending date) and 6 (descending date).
|
chris beaver |
Jan 17, 2009 |
Jun 01, 2009 |
| Printed |
Page 594
3rd paragraph (last block of text) |
It says to try out a few other variations, among one which is 707.827.7000, followed by how it should be noticed that the extra characters are removed. But the regex expression used does not remove the dots, only these characters: ( ) - \s.
Note from the Author or Editor: The regular expression does not remove dots from a phone number, so "707.827.7000" would remain unaffected. You would need to alter the $pattern regular expression on the page to remove dots for this to work as explained.
Change the first phone number at the bottom of the page to use dashes instead of dots. So 707.827.7000 changes to 707-827-7000. If we want to keep them a bit more varied, you could also change the last number in that same list to use all spaces instead of the one dash. So 707 827-7000 would become 707 827 7000.
|
Benjamin Groeneweg |
Jan 23, 2009 |
Jun 01, 2009 |
| Printed |
Page 598
Geek Bits |
'distrubuted' should be 'distributed'.
|
Thomas Kennedy |
Aug 20, 2010 |
Aug 26, 2011 |
| Printed |
Page 623
- |
The download captcha for chapter 11 contains SHA(), while this should be SHA1(). It causes an error when trying to run.
Note from the Author or Editor: On line 16 of the downloadable code for the captcha.php script, SHA should be sha1. The print version is OK.
|
Benjamin Groeneweg |
Jan 23, 2009 |
|
| Printed |
Page 715
Seventh row of table |
The order of the arguments to the mysql_query() function are in the wrong order, and should be swapped. The correct form of the function is mysql_query(query, conn).
Note from the Author or Editor: Should be changed as described in the errata submission.
|
 Michael Morrison
|
Dec 15, 2008 |
Jun 01, 2009 |
| Printed |
Page 721
Step 1, Write Your Class |
While declaring the function, "function song(...", the second argument is "$length". I expected it to be $lyrics.
Note from the Author or Editor: The second argument to the Song() function should be $lyrics, not $length. So the first line of the function code should look like this:
function Song($title, $lyrics) {
|
Neil Mc |
Jan 14, 2009 |
Jun 01, 2009 |
| Printed |
Page 733
1st paragraph |
Misspelled "browser" and "your". "..., open a brower window..." and "... alive and well on you local machine."
|
Anonymous |
May 15, 2011 |
Aug 26, 2011 |
| Printed |
Page 746
Last paragraph |
The first letter of the paragraph (the "I" in "Insert") is not bolded while the rest of the paragraph is bolded.
|
Dave Solomon |
May 27, 2011 |
Aug 26, 2011 |
|