Learning PHP, MySQL & JavaScript

Errata for Learning PHP, MySQL & JavaScript

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
PDF
Page 47
very bottom

The following statement in book: $ingredient = $ammonia xor $bleach; should be written as: $ingredient = ($ammonia xor $bleach); The additional parentheses are required due to operator precedence, as assignment holds tighter than xor. For instance, $ammonia = 0; $bleach = 1; $ingredient = $ammonia xor $bleach; echo $ingredient; print zero, even if it's obvious that result of 0 xor 1 is one. This is because the assignment statement is parsed as: ($ingredient = $ammonia) xor $bleach; hence $ingredient gets zero, than xor operator with $bleach results into one, but this operation is throwed out, as it operates in void context.

Note from the Author or Editor:
This is correct. The parentheses are required in this instance.

Grzegorz Szpetkowski  Jan 15, 2016 
Printed, PDF, Other Digital Version
Page 52
Example 3-9

In Example 3-9 when running the example exactly as printed in the book the PHP processor produces no output due to a missing statement (echo $out;)at the end of the code before the end of the PHP (?>). I will paste the code as it is in the book, then I will paste it again but will add the missing statement followed by a comment indicating that this is where I've added my correction like this: "// This is where I've added my correction to make the code work" Example 3-9 as it's printed in the book: ------------------------------------ <?php $author = "Scott Adams"; $out = <<<_END Normal people believe that if it ain't broke, don't fix it. Engineers believe that if it ain't broke, it doesn't have enough features yet. - $author. _END; ?> ------------------------------------ And with the correction needed to produce results. ------------------------------------ <?php $author = "Scott Adams"; $out = <<<_END Normal people believe that if it ain't broke, don't fix it. Engineers believe that if it ain't broke, it doesn't have enough features yet. - $author. _END; echo $out // This is where I've added my correction to make the code work ?> ------------------------------------ I'm a new programmer, to begin with, and am completely new to PHP, and couldn't figure out why something from a book wouldn't run, until Ah hahh, using knowledge from the book I found the problem. I guess according to example 3-8 I am smart enough to debug... Thanks for your attention. Matthew Lagasse

Note from the Author or Editor:
The following statement requires adding immediately prior to the closing ?> tag of Example 3-9: echo $out;

Matthew Lagasse  Jan 19, 2015  Apr 03, 2015
PDF, ePub, Mobi
Page 68
Above Table 4-2

There is an extra space between "prece" and "dence", so the original Table 4-2 lists PHP’s operators in order of prece dence from high to low. should be Table 4-2 lists PHP’s operators in order of precedence from high to low.

Note from the Author or Editor:
Yes, the occurrences of prece and dence should be replaced with the single word precedence.

Toby Wei  Jan 26, 2015  Apr 03, 2015
Printed
Page 107
Figure 5-3

Figure 5-3 text "A jukebox: a great example of a self-contained object". The graphic appears incorrect since it displays of a match box, not a jukebox. Please post a revised graphic on this website with appropriate symbols documenting a jukebox as a self-contained object.

Note from the Author or Editor:
In previous editions there used to be a picture of a jukebox here, but it has been accidentally dropped in the 4th edition. The correct image is here: http://lpmj.net/images/f5-03.png

Stepeh Rynas  Mar 12, 2015  Apr 03, 2015
Printed
Page 121
United States

Post-chapter questions include the seemingly nonsensical sentence "This is a second sentence in the list" after questions 1, 3, 5, and 10.

Note from the Author or Editor:
Thanks - very weird how that got there - all occurrences should be deleted.

Bob Reap  Jan 29, 2015  Apr 03, 2015
PDF
Page 191
Half way

The book states: "FULLTEXT indexes can be used only with MyISAM tables" This is incorrect, InnoDB tables can also have FULLTEXT indexes in MySQL5.6.

Note from the Author or Editor:
This bullet point should be updated by inserting the following in front of the existing text: Since MySQL 5.6 InnoDB tables can use FULLTEXT indexes, but prior to that

Jasper Kips  Jan 24, 2015  Apr 03, 2015
PDF, ePub, Mobi
Page 202
Figure 8-17

In Figure 8-17, the command to create table "customers" contains a wrong length of the column "isbn", which is supposed to be of 13 characters. In that figure it shows "VARCHAR(128)" in stead of the actual command offered "VARCHAR(13)."

Note from the Author or Editor:
Good catch. The corrected figure can be found at: http://lpmj.net/images/f8-17.png

Toby Wei  Jan 26, 2015  Apr 03, 2015
Printed
Page 203
Regno Unito

Hello, this book is very well done, I have spotted a little error in the Example 8-29 where the command is not consistent with the initial recommendation of the author related to capital letters to distinguish the SQL code from the names of the database tables, columns, and rows names.(page 173, first bullet). The command: SELECT name,author,title from customers,classics WHERE customers.isbn=classics.isbn; should be instead: SELECT name,author,title FROM customers,classics WHERE customers.isbn=classics.isbn; With 'FROM' in capital letters, as it does refer to a SQL command.

Note from the Author or Editor:
Yes, although the example still works, ideally the first line of Example 8-29 should be: SELECT name,author,title FROM customers,classics

Alessandro Coraglia  Jan 10, 2015  Apr 03, 2015
PDF, ePub, Mobi
Page 244
Bottom of the page (last two lines)

An extra parenthesis on the right of both $_POST['delete'] and $_POST['author']. So the original $_POST['delete']) ... $_POST['author']) ... should be $_POST['delete'] ... $_POST['author'] ...

Note from the Author or Editor:
Thanks, yes, the right hand parenthesis should be deleted after each occurrence of the right hand square bracket on these two lines.

Toby Wei  Jan 26, 2015  Apr 03, 2015
Printed
Page 253
Line 13

Code currently reads: echo "The Insert ID was: " .$result->insert_id; This results in an error message: "Trying to get property of non-object" Code should read: echo "The Insert ID was: " .$conn->insert_id;

Note from the Author or Editor:
In Example 10-14 this line: echo "The Insert ID was: " . $result->insert_id; Should be replaced with: echo "The Insert ID was: " . $conn->insert_id; Also, near the bottom of the page, the line that reads: $insertID = $result->insert_id; Should be changed to: $insertID = $conn->insert_id;

Les Ansley  Jan 15, 2015  Apr 03, 2015
PDF
Page 255
Example code

The code of additional query is as follows: $subresult = $conn->query($query); Should be rather $subresult = $conn->query($subquery); Otherwise it again refers to the first query and doesn't produce expected results.

Note from the Author or Editor:
In Example 10-15 this line: $subresult = $conn->query(query); Should be replaced with: $subresult = $conn->query($subquery);

Piotr Cieślak  Jan 19, 2015  Apr 03, 2015
Printed
Page 281
last paragraph

"implanted" should be "implemented" (presumably)

Note from the Author or Editor:
Correct - thanks for spotting this.

Bob Reap  Jan 31, 2015  Apr 03, 2015
Printed
Page 295
Example 12-3

In example 12-3 the "login.php" file that was created earlier in the book is used in the code to create and populate a new table however on line 4 of the example the mysql log-in details are referenced as below: ... new mysqli($db_hostname, $db_username, $db_password, $db_database); Which will cause an error. They should be as follows: ... new mysqli($hn, $un, $pw, $db);

Note from the Author or Editor:
You are correct, the third line of Example 12-3 should read: $connection = new mysqli($hn, $un, $pw, $db);

Tessa Lake  Feb 21, 2015  Apr 03, 2015
Printed
Page 300
Regno Unito

Hello Robin, I think there is an error in the last statement in bold where the original is: <a href=continue.php> and I believe it should be: <a href='continue.php'> Not such a horrible issue though... above all if I can spot it :o)

Note from the Author or Editor:
This is not exactly an error because all browsers allow URLs to not be encapsulated in quotation marks. However, to show best practice, I agree that the URL should be quoted.

Alessandro Coraglia  Jan 30, 2015  Apr 03, 2015
PDF, ePub, Mobi
Page 314
Bottom of the page

The example caption of Example 13-7 is showing an error message from Apple Safari console, so the original Example 13-7. An Opera Error Console message should be Example 13-7. An Apple Safari Console message

Note from the Author or Editor:
The heading for Example 13-7 should read: Example 13-7. An Apple Safari Console message

Toby Wei  Jan 26, 2015  Apr 03, 2015
PDF, ePub, Mobi
Page 329
2nd paragraph of 2nd section

There is a multiple word "have" in "You may, however, have have heard that ... "

Note from the Author or Editor:
Yes, the second 'have' should be deleted.

Toby Wei  Jan 26, 2015  Apr 03, 2015
PDF
Page 372
Example 16-1

The CSS class .signup is defined but not used. To get the same result as Figure16-1 the property class="signup" should be added to the <table> tag.

Note from the Author or Editor:
The first line of HTML in the <body> section should read: <table class="signup" border="0" cellpadding="2" cellspacing="5" bgcolor="#eeeeee">

Alessio Ulzi  Mar 16, 2015  Apr 03, 2015
PDF
Page 375
Example 16-2

The function isNaN returns false when an empty string is passed because JavaScript interprets it as a 0. So inside the validateAge function the first check should be something like if (field == "" || isNaN(field)) return "No Age was entered.\n" to get the same result as Figure 16-2

Note from the Author or Editor:
That is interesting. Indeed, tests confirm that isNaN() treats the empty string as if it were a number. Your solution to this is correct: Simply replace the first line of the function validateAge() with: if (field == "" || isNaN(field)) return "No Age was entered.\n"

Alessio Ulzi  Mar 16, 2015  Apr 03, 2015
Printed
Page 664
bottom paragraph

On page 664 of the book, bottom paragraph it reads "See chapter 13 for more details on how to do this", they are referring to hashed passwords. problem: chapter 13 does *not* contain any such information ,its actually found in chapter 12

Note from the Author or Editor:
Thanks - the correct Chapter is, indeed, 12.

claudio izzi  Jan 31, 2015  Apr 03, 2014